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

Already on GitHub? Sign in to your account

Allow specifying request_class on a per-blueprint basis #422

jfinkels opened this Issue Mar 8, 2012 · 2 comments


None yet
3 participants

jfinkels commented Mar 8, 2012

Suppose we have a situation in which a user creates a blueprint for a ReSTful JSON API and another blueprint for something else. On a badly formatted request, the URLs in the API blueprint will be parsing JSON (using Request.json) and should return JSON responses (possibly using Request.on_json_loading_failed), but bad requests to URLs in the other blueprint should respond with regular old HTML responses.

In this case the user should be able to set a custom Flask.request_class for the API blueprint only which overrides the on_json_loading_failed method.


jfinkels commented Mar 9, 2012

This could possibly be a deeper problem, in which the mimetype of the response should depend on the type of the request, by default.

@jfinkels jfinkels referenced this issue in jfinkels/flask-restless Mar 9, 2012


Use Request.json attribute instead of parsing ourselves #17


davidism commented Jun 2, 2017

Closing due to inactivity, and the general sense that there are better ways to handle what you're talking about. It wouldn't even be possible given the current flow, the request context sets up the request in order to match the url and blueprint, so we wouldn't know the blueprint yet.

@davidism davidism closed this Jun 2, 2017

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