Skip to content

Content-Length not set when using BodyJSON #49

Answered by earthboundkid
frankfil asked this question in Support
Discussion options

You must be logged in to vote

The standard library is inconsistent about when it wants a Reader and when it wants a ReadCloser. I am adapting Readers into ReadClosers with io.NopCloser, but it looks like that is interfering with the Content Length setter. I think the fix is that I should write my own NopCloser type and just strip it off the body passed into NewRequestWithContext, but I’m not sure. I’ll poke around and see what I can figure out.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@earthboundkid
Comment options

@earthboundkid
Comment options

@frankfil
Comment options

@earthboundkid
Comment options

@frankfil
Comment options

Answer selected by frankfil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants