Skip to content

Commit

Permalink
copy request body in fasthttp handler
Browse files Browse the repository at this point in the history
  • Loading branch information
andot committed Jan 25, 2024
1 parent 31295cc commit b2401a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rpc/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ func (h *Handler) ServeFastHTTP(ctx *fasthttp.RequestCtx) {
}
}
serviceContext := h.getFastHTTPServiceContext(ctx)
result, err := h.Service.Handle(core.WithContext(context.Background(), serviceContext), ctx.Request.Body())
body := ctx.Request.Body()
request := make([]byte, len(body))
copy(request, body)
result, err := h.Service.Handle(core.WithContext(context.Background(), serviceContext), request)
if err != nil {
h.onFastHTTPError(ctx, err)
}
Expand Down

0 comments on commit b2401a7

Please sign in to comment.