ctx Type — fiber Architecture
Architecture documentation for the ctx type/interface in ctx_interface_gen.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD a335f99e_a33d_41f8_05f7_aca44fa253b4["ctx"] 903c656d_fcfd_4b64_bd44_842af8f82a27["ctx_interface_gen.go"] a335f99e_a33d_41f8_05f7_aca44fa253b4 -->|defined in| 903c656d_fcfd_4b64_bd44_842af8f82a27 style a335f99e_a33d_41f8_05f7_aca44fa253b4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
ctx_interface_gen.go lines 18–489
type Ctx interface {
// App returns the *App reference to the instance of the Fiber application
App() *App
// BaseURL returns (protocol + host + base path).
BaseURL() string
// RequestCtx returns *fasthttp.RequestCtx that carries a deadline
// a cancellation signal, and other values across API boundaries.
RequestCtx() *fasthttp.RequestCtx
// Context returns a context implementation that was set by
// user earlier or returns a non-nil, empty context, if it was not set earlier.
Context() context.Context
// SetContext sets a context implementation by user.
SetContext(ctx context.Context)
// Deadline returns the time when work done on behalf of this context
// should be canceled. Deadline returns ok==false when no deadline is
// set. Successive calls to Deadline return the same results.
//
// Due to current limitations in how fasthttp works, Deadline operates as a nop.
// See: https://github.com/valyala/fasthttp/issues/965#issuecomment-777268945
Deadline() (time.Time, bool)
// Done returns a channel that's closed when work done on behalf of this
// context should be canceled. Done may return nil if this context can
// never be canceled. Successive calls to Done return the same value.
// The close of the Done channel may happen asynchronously,
// after the cancel function returns.
//
// Due to current limitations in how fasthttp works, Done operates as a nop.
// See: https://github.com/valyala/fasthttp/issues/965#issuecomment-777268945
Done() <-chan struct{}
// Err mirrors context.Err, returning nil until cancellation and then the terminal error value.
//
// Due to current limitations in how fasthttp works, Err operates as a nop.
// See: https://github.com/valyala/fasthttp/issues/965#issuecomment-777268945
Err() error
// Request return the *fasthttp.Request object
// This allows you to use all fasthttp request methods
// https://godoc.org/github.com/valyala/fasthttp#Request
// Returns nil if the context has been released.
Request() *fasthttp.Request
// Response return the *fasthttp.Response object
// This allows you to use all fasthttp response methods
// https://godoc.org/github.com/valyala/fasthttp#Response
// Returns nil if the context has been released.
Response() *fasthttp.Response
// Get returns the HTTP request header specified by field.
// Field names are case-insensitive
// Returned value is only valid within the handler. Do not store any references.
// Make copies or use the Immutable setting instead.
Get(key string, defaultValue ...string) string
// GetHeaders returns the HTTP request headers.
// Returned value is only valid within the handler. Do not store any references.
// Make copies or use the Immutable setting instead.
GetHeaders() map[string][]string
// GetReqHeaders returns the HTTP request headers.
// Returned value is only valid within the handler. Do not store any references.
// Make copies or use the Immutable setting instead.
GetReqHeaders() map[string][]string
// GetRespHeader returns the HTTP response header specified by field.
// Field names are case-insensitive
// Returned value is only valid within the handler. Do not store any references.
// Make copies or use the Immutable setting instead.
GetRespHeader(key string, defaultValue ...string) string
// GetRespHeaders returns the HTTP response headers.
// Returned value is only valid within the handler. Do not store any references.
// Make copies or use the Immutable setting instead.
GetRespHeaders() map[string][]string
// ClientHelloInfo return CHI from context
ClientHelloInfo() *tls.ClientHelloInfo
// Next executes the next method in the stack that matches the current route.
Next() error
// RestartRouting instead of going to the next handler. This may be useful after
// changing the request path. Note that handlers might be executed again.
RestartRouting() error
setHandlerCtx(ctx CustomCtx)
// OriginalURL contains the original request URL.
// Returned value is only valid within the handler. Do not store any references.
// Make copies or use the Immutable setting to use the value outside the Handler.
OriginalURL() string
// Path returns the path part of the request URL.
// Optionally, you could override the path.
// Make copies or use the Immutable setting to use the value outside the Handler.
Defined In
Source
Frequently Asked Questions
What is the ctx type?
ctx is a type/interface in the fiber codebase, defined in ctx_interface_gen.go.
Where is ctx defined?
ctx is defined in ctx_interface_gen.go at line 18.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free