biosustain / potion

Flask-Potion is a RESTful API framework for Flask and SQLAlchemy, Peewee or MongoEngine
http://potion.readthedocs.io
Other
488 stars 51 forks source link

Use last_modified / if_modified_since conditional headers #40

Open datashaman opened 9 years ago

datashaman commented 9 years ago

Emit a last_modified header linked to a property on the resource (and hence to a db column in the back-end).

Then there's no need to manage a cache in your client app. Any browser (and some client libraries) will cache everything correctly for you.

lyschoening commented 9 years ago

An ETag would be more reliable, given that APIs might have user-based permissions leading to different results regardless of modification date. This could be configured on a per-resource basis though.