You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to forward the client's response body to ctx response body without reading it into memory?
I do HTTP requests from my go code when receiving external requests in RequestHandler.
varclient*fasthttp.ClientfuncHandle(ctx*fasthttp.RequestCtx) {
req:=fasthttp.AcquireRequest()
rsp:=fasthttp.AcquireResponse()
deferfasthttp.ReleaseRequest(req)
deferfasthttp.ReleaseResponse(rsp)
iferr:=client.Do(req, rsp); err!=nil {
ctx.Response.SetStatusCode(fasthttp.StatusNotFound)
}
varbody []bytebody=append(body, rsp.Body()...) //need to copy it into a memory before exit the Handle functionctx.SetBody(body)
}
I would like to pass somehow rsp.Body() directly ctx.Response.
Thanks.
The text was updated successfully, but these errors were encountered:
Good day, guys,
Is it possible to forward the client's response body to ctx response body without reading it into memory?
I do HTTP requests from my go code when receiving external requests in RequestHandler.
I would like to pass somehow
rsp.Body()
directlyctx.Response
.Thanks.
The text was updated successfully, but these errors were encountered: