Prototype version: An example on how it would feel if we store flask.request information in the resource request context in the beginning of the request lifecycle. Also, resource request is configurable.
Pros
You could imitate a request without having an active request context by just inheriting the ResourceRequestCtx class and override the inject_original_request method i.e as it is done in the conftest.py.
Storing the flask.request metadata to an attribute instead of flattening it, would make easier the debugging of the initial request data. In case of flattening, we would need to prefix the flask.request information so they can be distinguished but you would have to iterate to them one by one to have the full picture of the initial request. FYI, requests library in python stores the request object requested the response, see Response.request attribute.
Prototype version: An example on how it would feel if we store
flask.request
information in the resource request context in the beginning of the request lifecycle. Also, resource request is configurable.Pros
ResourceRequestCtx
class and override theinject_original_request
method i.e as it is done in theconftest.py
.flask.request
metadata to an attribute instead of flattening it, would make easier the debugging of the initial request data. In case of flattening, we would need to prefix theflask.request
information so they can be distinguished but you would have to iterate to them one by one to have the full picture of the initial request. FYI,requests
library in python stores therequest
object requested the response, see Response.request attribute.