Skip to content

Chunked transfer encoding #796

@rampage644

Description

@rampage644

I've faced an issue similiar to what is described in #391. Namely, other 3rd party RESTful service is unable to parse incoming JSON body.

In the end, it boiled down to the inability of existing nginx/uwsgi/django setup to properly parse HTTP request without Content-Length header (dunno what element in the chain should be responsible for this).

What was happening under the hood is the way go-kit creates http.Request and initializes its body: since body is nil during construction, r.ContentLength is not set. The solution (as in mentioned issue) is to redefine encodeJSONRequest function to properly set required parameter.

Here we create a request with nil body: https://github.com/go-kit/kit/blob/master/transport/http/client.go#L114. This code is skipped due to nil body: https://github.com/golang/go/blob/master/src/net/http/request.go#L827

Please advise what is the best way of dealing with this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions