MCPcopy
hub / github.com/gofiber/fiber / GetHeaders

Method GetHeaders

req.go:491–501  ·  view source on GitHub ↗

GetHeaders (a.k.a GetReqHeaders) returns the HTTP request headers. Returned value is only valid within the handler. Do not store any references. Make copies or use the Immutable setting instead.

()

Source from the content-addressed store, hash-verified

489// Returned value is only valid within the handler. Do not store any references.
490// Make copies or use the Immutable setting instead.
491func (r *DefaultReq) GetHeaders() map[string][]string {
492 app := r.c.app
493 reqHeader := &r.c.fasthttp.Request.Header
494 // Pre-allocate map with known header count to avoid reallocations
495 headers := make(map[string][]string, reqHeader.Len())
496 for k, v := range reqHeader.All() {
497 key := app.toString(k)
498 headers[key] = append(headers[key], app.toString(v))
499 }
500 return headers
501}
502
503// Host contains the host derived from the X-Forwarded-Host or Host HTTP header.
504// Returned value is only valid within the handler. Do not store any references.

Callers

nothing calls this directly

Calls 3

toStringMethod · 0.80
LenMethod · 0.65
AllMethod · 0.65

Tested by

no test coverage detected