fix(transport): fix request body not send again when not authorized#73
fix(transport): fix request body not send again when not authorized#73Luckyboys wants to merge 1 commit intoheroku:masterfrom
Conversation
|
Thanks! Do you think you could utilize http.Request.GetBody() instead of copying the body in full ? |
What do you mean by changing the read req.Body to read the ReadCloser returned by req.GetBody()? |
|
I mean: |
1ebd5fc to
0806579
Compare
Thank you for reminding me, let me also learn this implementation. But I found new problem that req.GetBody function is . So, if we use the |
|
Sorry, maybe that was a bad idea. :-( Maybe test GetBody == nil { // do a copy } else { Body = GetBody() } ? |
Under normal circumstances, the body of req will be read to EOF when the first request is made. If the first request is due to the permission reason and there is no request to complete, it needs to re-request after obtaining the token. But at this time req's body has reached EOF and may even be closed, so when resending the request, you need to reset the body so that the next request can re-read the body.
0806579 to
e3e0b31
Compare
I have new idea. |
|
SGTM |
Under normal circumstances, the body of req will be read to EOF when the first request is made. If the first request is due to the permission reason and there is no request to complete, it needs to re-request after obtaining the token. But at this time req's body has reached EOF and may even be closed, so when resending the request, you need to reset the body so that the next request can re-read the body.