Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional Gets #61

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conditional Gets #61

wants to merge 10 commits into from

Conversation

kainswor
Copy link
Member

I implemented a conditional decorator from http://flask.pocoo.org/snippets/95/ and adapted it to fit within this project a little better.

The conditional generates an ETag (usually based on the sha of the asset, or dynamically from the content on other views), and a Cache-Control header to specify how the objects should be cached.
The Cache-Control header value is configurable- and a default is specified.

@kainswor
Copy link
Member Author

And in the future I should really squash some commits

@@ -624,6 +624,28 @@ def test_allowed_methods(self):
with self.cors_enabled:
self.assert_header_equal('Access-Control-Allow-Methods', 'HEAD, OPTIONS, GET')

class ConditionalGetTestCase(_RestfulGitTestCase):
cache_control = 'max-age=60'
def cget_helper(self, url, guess=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably split this into 3 test methods, one per GET request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants