Home / File/ cookie.go — fiber Source File

cookie.go — fiber Source File

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

File go 1 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

package binder

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

// CookieBinding is the cookie binder for cookie request body.
type CookieBinding struct {
	EnableSplitting bool
}

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

// Bind parses the request cookie and returns the result.
func (b *CookieBinding) Bind(req *fasthttp.Request, out any) error {
	data := make(map[string][]string)

	for key, val := range req.Header.Cookies() {
		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 CookieBinding binder.
func (b *CookieBinding) Reset() {
	b.EnableSplitting = false
}

Dependencies

  • v2

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free