Open
Description
It seems like the library is discarding the data
field when making GET
requests. I understand that this doesn't really conform to the older RFC2616 spec but some http clients can do it e.g. curl and python's requests.
How to reproduce
$ nc -l 4242
requests.get("http://localhost:4242", data = "lol")
What is expected
nc
should be printing this:
GET / HTTP/1.1
Content-Type: application/json
User-Agent: requests-scala
Accept-Encoding: gzip, deflate
Accept: */*
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:4242
Connection: keep-alive
lol
What actually happens
Instead nc
prints the request without the body.
GET / HTTP/1.1
Content-Type: application/json
User-Agent: requests-scala
Accept-Encoding: gzip, deflate
Accept: */*
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:4242
Connection: keep-alive
Fix?
I think this line here is the culprit but I'm not sure why GET
wasn't included in the if condition in the first place. https://github.com/com-lihaoyi/requests-scala/blob/master/requests/src/requests/Requester.scala#L254
if (verb.toUpperCase == "POST" || verb.toUpperCase == "PUT" || verb.toUpperCase == "PATCH" || verb.toUpperCase == "DELETE") {
...
}
Maybe we could add GET
to it?
Metadata
Metadata
Assignees
Labels
No labels