Skip to content

Commit

Permalink
piprequest, read request body to byte buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
superisaac committed Oct 27, 2023
1 parent d92bbed commit b4c9806
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nodemux/core/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ func (self *Endpoint) RespondRequest(rootCtx context.Context, path string, r *ht
// prepare request
// TODO: join the server url and method
url := self.FullUrl(path)
req, err := http.NewRequestWithContext(ctx, r.Method, url, r.Body)
body, err := io.ReadAll(r.Body)
if err != nil {
return nil, err
}
req, err := http.NewRequestWithContext(ctx, r.Method, url, io.NopCloser(bytes.NewBuffer(body)))
if err != nil {
return nil, errors.Wrap(err, "http.NewRequestWithContext")
}
Expand Down

0 comments on commit b4c9806

Please sign in to comment.