I am trying to send content of html file via gorequest PUT method. In documentation of service which I am trying to contact it is mentioned that type of body should be Content-Type: application/octet-stream.
When I execute:
req.Send(string(content))
where content is slice of bytes ([]byte
), my html file is broken, because content of the file is encoded, and all white spaces, special characters like <, > are replaced. When I execute:
req.Send(content)
I see that following content is sent: [60,104,116,109, .... ]
which is not what I would expect. Can you advise me how to transfer html file as a byte stream to webservice using gorequest?
Either set req.BounceToRawString
to true
or change the content type to text/plain
before sending the string.
From the docs at godoc.org:
If you have set Type to text or Content-Type to text/plain, content will be sent as raw string in body instead of form