Documentation
¶
Index ¶
- Variables
- func ConvertRequest(c fiber.Ctx, forServer bool) (*http.Request, error)
- func CopyContextToFiberContext(src any, requestContext *fasthttp.RequestCtx)deprecated
- func FiberApp(app *fiber.App) http.HandlerFunc
- func FiberHandler(h fiber.Handler) http.Handler
- func FiberHandlerFunc(h fiber.Handler) http.HandlerFunc
- func HTTPHandler(h http.Handler) fiber.Handler
- func HTTPHandlerFunc(h http.HandlerFunc) fiber.Handler
- func HTTPHandlerWithContext(h http.Handler) fiber.Handler
- func HTTPMiddleware(mw func(http.Handler) http.Handler) fiber.Handler
- func LocalContextFromHTTPRequest(r *http.Request) (context.Context, bool)
Constants ¶
This section is empty.
Variables ¶
var ( ErrRemoteAddrEmpty = errors.New("remote address cannot be empty") ErrRemoteAddrTooLong = errors.New("remote address too long") )
Functions ¶
func ConvertRequest ¶
ConvertRequest converts a fiber.Ctx to a http.Request. forServer should be set to true when the http.Request is going to be passed to a http.Handler.
The request is built from the path the router matched (see wiretarget.Routed), which the request line is set to; the returned request's URL and RequestURI alias that line's storage, as they do in fasthttpadaptor, so it is left in place. A routed path fasthttp would read as an authority rather than a path (see wiretarget.ParsesAsPath) is answered with fiber.ErrBadRequest instead of being set, since the request's host would then be read out of it; so is one holding a forged escape (see wiretarget.HasForgedEscape), which URL.Path would decode into a segment the router never matched. A streamed body over the app's BodyLimit returns fiber.ErrRequestEntityTooLarge.
func CopyContextToFiberContext
deprecated
func CopyContextToFiberContext(src any, requestContext *fasthttp.RequestCtx)
CopyContextToFiberContext copies the values of context.Context to a fasthttp.RequestCtx. This function safely handles struct fields, using unsafe operations only when necessary for unexported fields.
Deprecated: This function uses reflection and unsafe pointers; consider using explicit context passing.
func FiberApp ¶
func FiberApp(app *fiber.App) http.HandlerFunc
FiberApp wraps fiber app to net/http handler func
func FiberHandler ¶
FiberHandler wraps fiber handler to net/http handler
func FiberHandlerFunc ¶
func FiberHandlerFunc(h fiber.Handler) http.HandlerFunc
FiberHandlerFunc wraps fiber handler to net/http handler func
func HTTPHandler ¶
HTTPHandler wraps net/http handler to fiber handler
func HTTPHandlerFunc ¶
func HTTPHandlerFunc(h http.HandlerFunc) fiber.Handler
HTTPHandlerFunc wraps net/http handler func to fiber handler
func HTTPHandlerWithContext ¶
HTTPHandlerWithContext is like HTTPHandler, but additionally stores Fiber’s user context in the request context
func HTTPMiddleware ¶
HTTPMiddleware wraps net/http middleware to fiber middleware
Types ¶
This section is empty.