Home / Function/ acceptsOfferType() — fiber Function Reference

acceptsOfferType() — fiber Function Reference

Architecture documentation for the acceptsOfferType() function in helpers.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  5649869c_4dec_c6c6_be75_b82592a3c23f["acceptsOfferType()"]
  bec0e401_e4cd_f765_6df3_a79059073e50["helpers.go"]
  5649869c_4dec_c6c6_be75_b82592a3c23f -->|defined in| bec0e401_e4cd_f765_6df3_a79059073e50
  a901a40e_1c24_0b91_6e95_807b7ecdec87["paramsMatch()"]
  5649869c_4dec_c6c6_be75_b82592a3c23f -->|calls| a901a40e_1c24_0b91_6e95_807b7ecdec87
  style 5649869c_4dec_c6c6_be75_b82592a3c23f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

helpers.go lines 326–363

func acceptsOfferType(spec, offerType string, specParams headerParams) bool {
	var offerMime, offerParams string

	if i := strings.IndexByte(offerType, ';'); i == -1 {
		offerMime = offerType
	} else {
		offerMime = offerType[:i]
		offerParams = offerType[i:]
	}

	// Accept: */*
	if spec == "*/*" {
		return paramsMatch(specParams, offerParams)
	}

	var mimetype string
	if strings.IndexByte(offerMime, '/') != -1 {
		mimetype = offerMime // MIME type
	} else {
		mimetype = utils.GetMIME(offerMime) // extension
	}

	if spec == mimetype {
		// Accept: <MIME_type>/<MIME_subtype>
		return paramsMatch(specParams, offerParams)
	}

	s := strings.IndexByte(mimetype, '/')
	specSlash := strings.IndexByte(spec, '/')
	// Accept: <MIME_type>/*
	if s != -1 && specSlash != -1 {
		if utils.EqualFold(spec[:specSlash], mimetype[:s]) && (spec[specSlash:] == "/*" || mimetype[s:] == "/*") {
			return paramsMatch(specParams, offerParams)
		}
	}

	return false
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does acceptsOfferType() do?
acceptsOfferType() is a function in the fiber codebase, defined in helpers.go.
Where is acceptsOfferType() defined?
acceptsOfferType() is defined in helpers.go at line 326.
What does acceptsOfferType() call?
acceptsOfferType() calls 1 function(s): paramsMatch.

Analyze Your Own Codebase

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

Try Supermodel Free