-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✏️✨ added new middleware feature tags
├── ✨ the tags: │ pigeon.middleware.MiddlewareTags │ attribute will be set by the middleware for every │ request └── ✏️🐛 fixed typo
- Loading branch information
Showing
5 changed files
with
37 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class MiddlewareTags: | ||
""" | ||
Used to tag requests by middleware. Tags will be further used when processing | ||
requeqst (especially in postprocessing) to further analyze the nature of the request | ||
and set appropriate headers. | ||
A tag can be accessed using MiddlewareTags().<tagname> and will either return its respective | ||
value or False if it has not been set. This allows for processing of tags even if they have not | ||
been set. | ||
To set a tag | ||
""" | ||
def __init__(self): | ||
self._tags = dict() | ||
|
||
def __getattr__(self, key): | ||
return self._tags.get(key) or False | ||
|
||
def set(self, key, value): | ||
self._tags[key] = value | ||
|
0463f6d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix #19
(added cache-control)