I'm setting the headers like this: where file is a test.txt
size = File.size(file)
h = {
"Content-Type": 'text/plain'
"Content-Length": size.to_s,
"Other-Header": 'some-header'
}
b = File.read(file)
HTTParty.post('/some/api/url', {headers: h , body: b})
The request headers get set like this:
<- "POST /some/api/url\r\n
Content-Type: text/plain\r\n
Content-Length: 16\r\n
Other-Header: some-header\r\n
Connection: close\r\n
Host: somehost.com\r\n
Content-Length: 16\r\n
Content-Type: application/x-www-form-urlencoded\r\n\r\n"
Content-Length and Content-Type are added and duplicated, besides Transfer-Encoding gets set to chunked.
How can one set Content-Length, Content-Type and Transfer-Encoding and avoid HTTParty setting them on its own?
Hope it's clear.
Thx for your time!
Try this