Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to Chunk-Encoded Requests #13

Open
JulioJu opened this issue May 23, 2019 · 3 comments
Open

Support to Chunk-Encoded Requests #13

JulioJu opened this issue May 23, 2019 · 3 comments

Comments

@JulioJu
Copy link

JulioJu commented May 23, 2019

Hi !

When we could see in __roast_headers__, on each request `Content-Length is automatically append in the header request.

even if the roast file is like :

POST http://google.fr
PUT http://google.fr
DELETE http://google.fr

Note: for GET http://google.fr the Content-Length header is not added.

It's a big problem because if we want specify the header Transfer-Encoding: chunked it cause a conflict.
The HTTP specification says:
"Expert Info (Warning/Malformed): The Content-Length and Transfer-Encoding header must not be set together" (message from Wireshark).

See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding

Maybe it could be cool to have a way to not add automatically this HEADER field.

Thanks in advance.

@JulioJu JulioJu changed the title Content-Length Request HEADER automatically append on POST PUT DELETE Content-Length Request HEADER automatically append on POST PUT DELETE (and should not) May 24, 2019
@JulioJu
Copy link
Author

JulioJu commented May 24, 2019

With curl (therefore with https://github.com/diepm/vim-rest-console/ )
to unset a field header we could simply use something like

Accept:

For instance thanks Wireshark we could know that

curl http://google.com appends some headers automatically like Accept: */*. To remove it simply use
curl http://google.com -H 'Accept:. In Wireshark we see that the header Accept is not append.

@JulioJu JulioJu mentioned this issue May 24, 2019
@sharat87
Copy link
Owner

sharat87 commented Jun 5, 2019

Hi Julio, I'm not explicitly adding a Content-Length header. It might be the requests library that's doing it. Can you give an example with setting the Transfer-Encoding header that demonstrates this problem please?

@JulioJu
Copy link
Author

JulioJu commented Jun 23, 2019

@sharat87

If you want an example, use

Transfer-Encoding: chunk
POST http://localhost:3030

You could see in the __roast-headers__ window that an header with Content-Length was appended.

As I said in the first comment, chunked request have this problem. A chunked request should not have the Content-Length header (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding).

It seams that you must do something like http://2.python-requests.org/en/master/user/advanced/#chunk-encoded-requests

But probably it's not so important. Support Chunk-Encoded request is probably not a goal very important. Maybe nobody is interesting in this feature.

@JulioJu JulioJu changed the title Content-Length Request HEADER automatically append on POST PUT DELETE (and should not) Chunk-Encoded Requests Jun 23, 2019
@JulioJu JulioJu changed the title Chunk-Encoded Requests Support to Chunk-Encoded Requests Jun 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants