Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created July 9, 2020 23:15
Show Gist options
  • Save miguelmota/c88d6a7750cf2dab20f9a5d43f6b81c4 to your computer and use it in GitHub Desktop.
Save miguelmota/c88d6a7750cf2dab20f9a5d43f6b81c4 to your computer and use it in GitHub Desktop.
Golang disable request chunked transfer encoding
// explicity setting the content-length will disable the "transfer-encoding: chunked" header
req.ContentLength = int64(len(requestBody))
// you can also remove the transfer-encoding header with this,
// however setting the content-length header is still required.
req.TransferEncoding = []string{"identity"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment