MCPcopy
hub / github.com/gin-gonic/gin / Abort

Method Abort

context.go:207–209  ·  view source on GitHub ↗

Abort prevents pending handlers from being called. Note that this will not stop the current handler. Let's say you have an authorization middleware that validates that the current request is authorized. If the authorization fails (ex: the password does not match), call Abort to ensure the remaining

()

Source from the content-addressed store, hash-verified

205// If the authorization fails (ex: the password does not match), call Abort to ensure the remaining handlers
206// for this request are not called.
207func (c *Context) Abort() {
208 c.index = abortIndex
209}
210
211// AbortWithStatus calls `Abort()` and writes the headers with the specified status code.
212// For example, a failed attempt to authenticate a request could use: context.AbortWithStatus(401).

Callers 6

AbortWithStatusMethod · 0.95
AbortWithStatusJSONMethod · 0.95
RenderMethod · 0.95
CustomRecoveryWithWriterFunction · 0.80
TestContextIsAbortedFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestContextIsAbortedFunction · 0.64