Problem:
When you define a view method in a subclass of ContentNegotiatedMethodView you can currently return (retval):
- a response (no call to
make_response())
- a list/tuple which will call
make_response(*retval)
- anything else which will call
make_response(retval)
See here
This causes confusion with Flask's make_response which behaves differently, and it also makes it hard to 1) get a consistent API for serialisers over many modules 2) change simple things like e.g. response code while keeping the serialiser the same.
Example:
GET/POST serialisation of an object is likely the same, but often response code will be 200 vs 201/202.
Proposals
- A) Always just call
make_response() explicitly from views
- B) Align with Flask's
make_response() and allow either 1) a response (already possible today) or 2) a 2/3-tuple of (response, status, headers) or (response, headers)
Problem:
When you define a view method in a subclass of
ContentNegotiatedMethodViewyou can currently return (retval):make_response())make_response(*retval)make_response(retval)See here
This causes confusion with Flask's
make_responsewhich behaves differently, and it also makes it hard to 1) get a consistent API for serialisers over many modules 2) change simple things like e.g. response code while keeping the serialiser the same.Example:
GET/POST serialisation of an object is likely the same, but often response code will be 200 vs 201/202.
Proposals
make_response()explicitly from viewsmake_response()and allow either 1) a response (already possible today) or 2) a 2/3-tuple of (response, status, headers) or (response, headers)