How to remove http header transfer-encoding: chunked

1,943 views
Skip to first unread message

Awaken

unread,
Sep 14, 2011, 3:34:20 PM9/14/11
to golang-nuts
Hi,
I'm trying to use Go to access Amazon S3. But when I tried to put an
object in a bucket, I'm keeping get 501 error from S3. A quick google
showed that it's caused by a "transfer-encoding:chunked" entry in the
header which is not supported by S3.
Anyone has idea of how to get rid of this entry in the header?

Brad Fitzpatrick

unread,
Sep 14, 2011, 4:38:38 PM9/14/11
to Awaken, golang-nuts
All HTTP/1.1 requests need to have either a Content-Length or be Transfer-Encoding "chunked".  Amazon should support either, but they don't.

So you need to set a Content-Length on your http Request, since it can't be inferred from your http Request's Body.

Just set your http.Request.ContentLength.
Reply all
Reply to author
Forward
0 new messages