Skip to content

Commit b2401a7

Browse files
committed
copy request body in fasthttp handler
1 parent 31295cc commit b2401a7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rpc/http/handler.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ func (h *Handler) ServeFastHTTP(ctx *fasthttp.RequestCtx) {
276276
}
277277
}
278278
serviceContext := h.getFastHTTPServiceContext(ctx)
279-
result, err := h.Service.Handle(core.WithContext(context.Background(), serviceContext), ctx.Request.Body())
279+
body := ctx.Request.Body()
280+
request := make([]byte, len(body))
281+
copy(request, body)
282+
result, err := h.Service.Handle(core.WithContext(context.Background(), serviceContext), request)
280283
if err != nil {
281284
h.onFastHTTPError(ctx, err)
282285
}

0 commit comments

Comments
 (0)