[bug] http.Request.Body is not readable in RegisterInterceptFunc or RegisterBeforeFunc
groovili opened this issue · 4 comments
Describe the bug
In v2/server package newCodecRequest is called before interceptFunc and
beforeFunc and performs request.Body.Close(), in such way funcs which would be called later can't read or alter data in body.
Versions
Go version: go1.14.2 darwin/amd64
package version: 27d3316
Steps to Reproduce
Try to modify request.Body in functions registered with RegisterInterceptFunc or RegisterBeforeFunc.
Expected behavior
Documentation says that functions which added with RegisterInterceptFunc or RegisterBeforeFunc would be called before every request. I assume, that these methods are made to alter or access request content. Since RPC is a protocol which mostly uses request.Body to transfer data, I think it should be accessible and changeable in these functions.
I can make PR to change this behavior if these changes are ok. Also, it wouldn't be breaking changes.
Thanks for the package and looking forward to your feedback!
up