Home / Function/ shouldIncludeCharset() — fiber Function Reference

shouldIncludeCharset() — fiber Function Reference

Architecture documentation for the shouldIncludeCharset() function in res.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  2b2b8db6_0538_2d41_2284_feb6e47c5949["shouldIncludeCharset()"]
  4ab93de8_955a_4087_8264_32cf8000452f["res.go"]
  2b2b8db6_0538_2d41_2284_feb6e47c5949 -->|defined in| 4ab93de8_955a_4087_8264_32cf8000452f
  style 2b2b8db6_0538_2d41_2284_feb6e47c5949 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

res.go lines 1063–1083

func shouldIncludeCharset(mimeType string) bool {
	// Everything under text/ gets UTF-8 by default.
	if strings.HasPrefix(mimeType, "text/") {
		return true
	}

	// Explicit application types that should default to UTF-8.
	switch mimeType {
	case MIMEApplicationJSON,
		MIMEApplicationJavaScript,
		MIMEApplicationXML:
		return true
	}

	// Any application/*+json or application/*+xml.
	if strings.HasSuffix(mimeType, "+json") || strings.HasSuffix(mimeType, "+xml") {
		return true
	}

	return false
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does shouldIncludeCharset() do?
shouldIncludeCharset() is a function in the fiber codebase, defined in res.go.
Where is shouldIncludeCharset() defined?
shouldIncludeCharset() is defined in res.go at line 1063.

Analyze Your Own Codebase

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

Try Supermodel Free