I would like to use mutable dict for request.args and request.form. Werkzeug and Flask create an ImmutableMultiDict for this data. Is there a way to make this mutable?
I would like to use mutable dict for request.args and request.form . Werkzeug and
Share
According to the Werkzeug documentation, you update the
parameter_storage_classattribute on theRequestclass to use the type you want. If you also want to do the same thing for data other thanargsandform, you update thedict_storage_classattribute. The documentation notes:It is not recommended to make this mutable because the request data is whatever came from the client. Changing it will mean it no longer matches what the client sent. There is likely a better way to pass around custom values, such as using Flask’s
before_requestandg.The Flask documentation shows how to modify and use a
Requestsubclass for an application.