stoewer/go-nakadi

Request should be recreated when retried in client.httpXXXX functions

Closed this issue · 0 comments

krnkl commented

Client functions that perform a HTTP request will retry if request failed. However, request instance is reused when calling http.Client.Do method. Thus, on second attempt 0 bytes will be read from request body.
We need to make sure that request is recreated every time retry occurs. This might affect client.httpPut and client.httpPost methods.

errors printed from retry:

Post http://localhost:8888/event-types/xxxxx/events: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
Post http://localhost:8888/event-types/xxxxx/events: http: ContentLength=981875 with Body length 0