Werkzeug has speculated that the request is modified only in the WSGI middleware or before Werkzeug accesses the data. The reason is that in this way Werkzeug does not have to monitor the WSGI environment to see if caching or behavior change is canceled.
In this particular case, you can be successful, however, if you are careful by changing the underlying WSGI environment:
request.environ['REQUEST_METHOD'] = 'something'
After that, request.method
should show βsomething,β and the behavior should change to form the parsing. I have not tried this and do not know if this will work. Personally, I would write middleware that performs rewriting for the entire application, or perhaps uses a simple sample url prefix for this behavior.
Armin ronacher
source share