MCPcopy
hub / github.com/valyala/fasthttp / TimeoutErrorWithCode

Method TimeoutErrorWithCode

server.go:1687–1692  ·  view source on GitHub ↗

TimeoutErrorWithCode sets response body to msg and response status code to statusCode. All response modifications after TimeoutErrorWithCode call are ignored. TimeoutErrorWithCode MUST be called before returning from RequestHandler if there are references to ctx and/or its members in other gorouti

(msg string, statusCode int)

Source from the content-addressed store, hash-verified

1685// Usage of this function is discouraged. Prefer eliminating ctx references
1686// from pending goroutines instead of using this function.
1687func (ctx *RequestCtx) TimeoutErrorWithCode(msg string, statusCode int) {
1688 var resp Response
1689 resp.SetStatusCode(statusCode)
1690 resp.SetBodyString(msg)
1691 ctx.TimeoutErrorWithResponse(&resp)
1692}
1693
1694// TimeoutErrorWithResponse marks the ctx as timed out and sends the given
1695// response to the client.

Callers 3

TimeoutErrorMethod · 0.95
TimeoutWithCodeHandlerFunction · 0.80

Calls 3

SetStatusCodeMethod · 0.95
SetBodyStringMethod · 0.95

Tested by 1