Home / File/ req.go — fiber Source File

req.go — fiber Source File

Architecture documentation for req.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberCore Routing 1 imports 4 functions 10 classes

Entity Profile

Dependency Diagram

graph LR
  4a59f3b7_da1d_e590_a74b_87c592120e01["req.go"]
  c0b86961_3ef1_0168_52fc_98627566ed27["bytes"]
  4a59f3b7_da1d_e590_a74b_87c592120e01 --> c0b86961_3ef1_0168_52fc_98627566ed27
  style 4a59f3b7_da1d_e590_a74b_87c592120e01 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package fiber

import (
	"bytes"
	"errors"
	"fmt"
	"math"
	"mime/multipart"
	"net"
	"strconv"
	"strings"

	"github.com/gofiber/utils/v2"
	"github.com/valyala/bytebufferpool"
	"github.com/valyala/fasthttp"
	"golang.org/x/net/idna"
)

// Pre-allocated byte slices for common header comparisons to avoid allocations
var (
	xForwardedPrefix        = []byte("X-Forwarded-")
	xForwardedProtoBytes    = []byte(HeaderXForwardedProto)
	xForwardedProtocolBytes = []byte(HeaderXForwardedProtocol)
	xForwardedSslBytes      = []byte(HeaderXForwardedSsl)
	xURLSchemeBytes         = []byte(HeaderXUrlScheme)
	onBytes                 = []byte("on")
)

// Range represents the parsed HTTP Range header extracted by DefaultReq.Range.
type Range struct {
	Type   string
	Ranges []RangeSet
}

// RangeSet represents a single content range from a request.
type RangeSet struct {
	Start int64
	End   int64
}

// DefaultReq is the default implementation of Req used by DefaultCtx.
//
//go:generate ifacemaker --file req.go --struct DefaultReq --iface Req --pkg fiber --output req_interface_gen.go --not-exported true --iface-comment "Req is an interface for request-related Ctx methods."
type DefaultReq struct {
	c *DefaultCtx
}

// Accepts checks if the specified extensions or content types are acceptable.
func (r *DefaultReq) Accepts(offers ...string) string {
	header := joinHeaderValues(r.c.fasthttp.Request.Header.PeekAll(HeaderAccept))
	return getOffer(header, acceptsOfferType, offers...)
}

// AcceptsCharsets checks if the specified charset is acceptable.
func (r *DefaultReq) AcceptsCharsets(offers ...string) string {
	header := joinHeaderValues(r.c.fasthttp.Request.Header.PeekAll(HeaderAcceptCharset))
	return getOffer(header, acceptsOffer, offers...)
}

// AcceptsEncodings checks if the specified encoding is acceptable.
// ... (1052 more lines)

Domain

Subdomains

Dependencies

  • bytes

Frequently Asked Questions

What does req.go do?
req.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Routing subdomain.
What functions are defined in req.go?
req.go defines 4 function(s): GetReqHeader, Locals, Params, Query.
What does req.go depend on?
req.go imports 1 module(s): bytes.
Where is req.go in the architecture?
req.go is located at req.go (domain: FiberCore, subdomain: Routing).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free