Bug: http post with body
MaxBear opened this issue · 4 comments
There is a bug with this library. If you use the wrapper to send http post with body (eg. json) you will get a "ContentLeng=... with Body length is 0" error. The reason being "body" in http.request object is io.reader, it is being read once when doing authentication and is depleted. When the actual request is sent to server after authenticated, the buffer is already drained and is empty, thus the length 0 error. I find this post particular useful , it fixes the bug:
https://stackoverflow.com/questions/23070876/reading-body-of-http-request-without-modifying-request-state
Same here, I forked and fixed it here.
I met the same problem
It is 2023 and this problem has not been solved yet. Is there any substitute?
The https://github.com/mongodb-forks/digest fork doesn't have this problem. I've been using it for a couple of years.