-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
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.