extractors.go — fiber Source File
Architecture documentation for extractors.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 9369d97d_10d6_c835_81b9_8542715b2822["extractors.go"] fcef1725_af89_d6cd_36cd_b228cdcc5acd["errors"] 9369d97d_10d6_c835_81b9_8542715b2822 --> fcef1725_af89_d6cd_36cd_b228cdcc5acd style 9369d97d_10d6_c835_81b9_8542715b2822 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package extractors
// Package extractors provides shared value extraction utilities for Fiber middleware.
// This package helps reduce code duplication across middleware packages
// while ensuring consistent behavior, security practices, and RFC compliance.
// It can extract string values from various HTTP request sources including
// headers, cookies, query parameters, form data, and URL parameters.
//
// Example usage:
//
// import "github.com/gofiber/fiber/v3/extractors"
//
// // Extract from Authorization header
// authExtractor := extractors.FromAuthHeader("Bearer")
//
// // Chain multiple sources with fallback
// tokenExtractor := extractors.Chain(
// extractors.FromHeader("X-API-Key"),
// extractors.FromCookie("api_key"),
// extractors.FromQuery("token"),
// )
//
// Security considerations:
// - Query parameters and form data can leak sensitive information
// - Use HTTPS to protect extracted values in transit
// - Consider source-specific security policies for your use case
import (
"errors"
"net/url"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/utils/v2"
)
// Source represents the type of source from which an API key is extracted.
// This is informational metadata that helps developers understand the extractor behavior.
type Source int
const (
// SourceHeader indicates the value is extracted from an HTTP header.
SourceHeader Source = iota
// SourceAuthHeader indicates the value is extracted from the Authorization header.
SourceAuthHeader
// SourceForm indicates the value is extracted from form data.
SourceForm
// SourceQuery indicates the value is extracted from URL query parameters.
SourceQuery
// SourceParam indicates the value is extracted from URL path parameters.
SourceParam
// SourceCookie indicates the value is extracted from cookies.
SourceCookie
// SourceCustom indicates the value is extracted using a custom extractor function.
SourceCustom
// ... (472 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- errors
Source
Frequently Asked Questions
What does extractors.go do?
extractors.go is a source file in the fiber codebase, written in go. It belongs to the DataBinding domain, Extractors subdomain.
What functions are defined in extractors.go?
extractors.go defines 10 function(s): Chain, Ctx, FromAuthHeader, FromCookie, FromCustom, FromForm, FromHeader, FromParam, FromQuery, isValidToken68.
What does extractors.go depend on?
extractors.go imports 1 module(s): errors.
Where is extractors.go in the architecture?
extractors.go is located at extractors/extractors.go (domain: DataBinding, subdomain: Extractors, directory: extractors).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free