Closed bigodel closed 2 months ago
Also, I would like to propose that the cURL version of form data requests be formatted as curl -F <name>=@<filename> ...
.
I've tried to fix this in https://github.com/federicotdn/verb/commit/c4e6a75b85027f7f3d635e54d3d190c3d34fd01e, basically as you said the newlines were incorrectly set to LF when they should've been set to CRLF. There is no easy way of enforcing users to use CRLF (apart from the old README section that explained how to add them manually) so the new solution is to just add this to requests using multipart:
:properties:
:Verb-Map-Request: verb-body-cr-to-crlf
:end:
The problem
I have been having issues using Verb for multipart requests. When trying to use to make requests to a Eclipse Jetty server I was having two kinds of issues:
Steps to reproduce
The request I was using is the following:
where
/tmp/foo
's content is simplytesting
. And the problem occurs regardless of using\r\n
as newline.I also tried doing requests to HTTPBin to see if it was a problem with my server's setup. I constructed the request as follows
The expected result is
but instead the response I get doesn't have anything under the
"files"
key (also regardless of using CLRF as newline).Using Postman
For testing purposes, I decided to try out the same request on Postman. Roughly the same request on both my web server and HTTPBin work fine on Postman. Here's how Postman formats the HTTPBin request
and it is similar with my own server's request, just changing the
Host
header.Closing thoughts
I have a theory that this issue is mainly caused by the lack of a space between the
Content-Type: text/plain
and the data from the file, but I'm not sure if that's the case on the final request, but I can observe it when exporting the requests to either Verb or cURL formats, as shown bellow