Manlio P. wrote:
2) Any non file parts are urlencoded and written to the new body
3) Files are written to temporary files, and in the new body is written:
where name is the field name and path is the temporary path used to
store the file.
With this method an application needs only to care about urlencoded
The problem with application/x-www-form-urlencoded is that it is
percent-encoded and multipart/form-data is not, thus requiring us to
deal with encoding, etc. Dealing with encodings is generally a bad idea
and I prefer to think about request body as a stream of bytes.
Another problem is that if we rename attributes to name.filename= and
name.path= this will require modifying existing applications and such
thing would be quite unuseful.
Therefore what I do now is transferring almost identical request body to
the backend with file fields converted to normal fields containing
The current code is available under
but it has a problem with generating header for error responses. Use it
on your own risk.