Home / File/ header.go — fiber Source File

header.go — fiber Source File

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

File go 1 imports

Entity Profile

Dependency Diagram

graph LR
  d2075773_41fc_236c_7bd3_17b850e5f7df["header.go"]
  baa5866c_7884_3b82_5e75_ef5c8f224470["v2"]
  d2075773_41fc_236c_7bd3_17b850e5f7df --> baa5866c_7884_3b82_5e75_ef5c8f224470
  style d2075773_41fc_236c_7bd3_17b850e5f7df fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package binder

import (
	"github.com/gofiber/utils/v2"
	"github.com/valyala/fasthttp"
)

// HeaderBinding is the binder implementation used to populate values from HTTP headers.
type HeaderBinding struct {
	EnableSplitting bool
}

// Name returns the binding name.
func (*HeaderBinding) Name() string {
	return "header"
}

// Bind parses the request header and returns the result.
func (b *HeaderBinding) Bind(req *fasthttp.Request, out any) error {
	data := make(map[string][]string)
	for key, val := range req.Header.All() {
		k := utils.UnsafeString(key)
		v := utils.UnsafeString(val)
		if err := formatBindData(b.Name(), out, data, k, v, b.EnableSplitting, false); err != nil {
			return err
		}
	}

	return parse(b.Name(), out, data)
}

// Reset resets the HeaderBinding binder.
func (b *HeaderBinding) Reset() {
	b.EnableSplitting = false
}

Dependencies

  • v2

Frequently Asked Questions

What does header.go do?
header.go is a source file in the fiber codebase, written in go.
What does header.go depend on?
header.go imports 1 module(s): v2.
Where is header.go in the architecture?
header.go is located at binder/header.go (directory: binder).

Analyze Your Own Codebase

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

Try Supermodel Free