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

Add Last-Modified header #190

Open
jfinkels opened this issue Apr 24, 2013 · 4 comments
Open

Add Last-Modified header #190

jfinkels opened this issue Apr 24, 2013 · 4 comments

Comments

@jfinkels
Copy link
Owner

and possible ETag?

@jfinkels
Copy link
Owner Author

jfinkels commented May 8, 2013

See also http://flask.pocoo.org/snippets/95/

@k-funk
Copy link

k-funk commented Sep 10, 2014

+1

@jfinkels
Copy link
Owner Author

jfinkels commented Mar 6, 2016

I think this is out-of-scope for Flask-Restless, as it depends on how the user implements the last update time in the model. It can be implemented by a preprocessor, which could check the headers, the last-update time, the etag, etc., then raise a ProcessingException with the appropriate status code (e.g. 304 Not Modified). This may be valuable as an example or in the documentation, so I'm marking this as a documentation issue.

@TrilceAC
Copy link

TrilceAC commented Oct 6, 2016

Agree. I like what @jfinkels proposes because you don't have to modify your model or add a new field just because you want this common feature. Instead, considering that you have some timestamp field, you only have to follow a recipe.

Another way to do this, could be by somehow implementing a function, maybe a decorator, that given a model field, it generates the header info and the proper checker to check whether it has been modified or not. I like this approach too, because you offer the functionality, but you are free to choose which field (or even fields) are those that need to be checked before updating.

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

No branches or pull requests

3 participants