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

Better mechanism for content negotiation #157

Open
fluffy-critter opened this Issue Jan 4, 2019 · 1 comment

Comments

Projects
None yet
1 participant
@fluffy-critter
Copy link
Collaborator

fluffy-critter commented Jan 4, 2019

Expected Behavior

It would be great to have a configurable and client-driven fallback mechanism for template resolution; for example, if there's both templates/feed.html and templates/feed.xml, have http://example.com/feed serve up feed.html to web browsers and feed.xml to RSS readers.

Current Behavior

Content negotiation is based on a hard-coded priority system that's universal to all templates, and disregards the client's request.

Context

Very useful for supporting more dynamism in templates and more user-friendly feed presentation and so on.

@fluffy-critter

This comment has been minimized.

Copy link
Collaborator

fluffy-critter commented Jan 5, 2019

Thoughts: have some sort of configurable mapping (ideally on a per-category and/or per-template basis) that sets the content-type for each extension, and also a default q-value for use with the Accept: header (i.e. set a default priority internally but let the user-agent override it on a per-type basis) and then choose the highest q-value for which template to use.

This mapping file could also be where we can configure other headers for the response, such as cache-control or content-type, rather than continuing to use the crappy hard-coded mapping in rendering.py.

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