You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to send file bytes to the body using req SetFileBytes(). However, every time a retry was performed, I saw a case where the request failed. When I checked the server log receiving the request, the file byte length was 0.
My guess is that there is an error in the retry logic using the SetFileBytes() function. So, looking at the logic, I think that when retrying with roundTrip, the logic that sends the file seeker to the initial position of the file does not work.
Below code is writeMultipartFormFile() function in middleware.go start 66 line. I think this logic should work, but does not work in SetFileBytes() cause it's type is io.ReadCloser.
if r.RetryAttempt > 0 { // reset file reader when retry a multipart file upload
if rs, ok := content.(io.ReadSeeker); ok {
_, err = rs.Seek(0, io.SeekStart)
if err != nil {
return err
}
}
}
Please comment if my guess is wrong.
To solve the problem situation, we are temporarily executing SetFileBytes() every time with SetRetryHook().
The text was updated successfully, but these errors were encountered:
go version: 1.21.3
req version: v3.42.1
I tried to send file bytes to the body using req SetFileBytes(). However, every time a retry was performed, I saw a case where the request failed. When I checked the server log receiving the request, the file byte length was 0.
My guess is that there is an error in the retry logic using the SetFileBytes() function. So, looking at the logic, I think that when retrying with roundTrip, the logic that sends the file seeker to the initial position of the file does not work.
Below code is writeMultipartFormFile() function in middleware.go start 66 line. I think this logic should work, but does not work in SetFileBytes() cause it's type is io.ReadCloser.
Please comment if my guess is wrong.
To solve the problem situation, we are temporarily executing SetFileBytes() every time with SetRetryHook().
The text was updated successfully, but these errors were encountered: