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

Method Error

server.go:1405–1410  ·  view source on GitHub ↗

Error sets response status code to the given value and sets response body to the given message. Warning: this will reset the response headers and body already set!

(msg string, statusCode int)

Source from the content-addressed store, hash-verified

1403//
1404// Warning: this will reset the response headers and body already set!
1405func (ctx *RequestCtx) Error(msg string, statusCode int) {
1406 ctx.Response.Reset()
1407 ctx.SetStatusCode(statusCode)
1408 ctx.SetContentTypeBytes(defaultContentType)
1409 ctx.SetBodyString(msg)
1410}
1411
1412// Success sets response Content-Type and body to the given values.
1413func (ctx *RequestCtx) Success(contentType string, body []byte) {

Callers 3

TimeoutWithCodeHandlerFunction · 0.45
acceptConnFunction · 0.45
defaultErrorHandlerFunction · 0.45

Calls 4

SetStatusCodeMethod · 0.95
SetContentTypeBytesMethod · 0.95
SetBodyStringMethod · 0.95
ResetMethod · 0.65

Tested by

no test coverage detected