MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / IsJSONContentType

Function IsJSONContentType

internal/htmlsanitize/htmlsanitize.go:84–91  ·  view source on GitHub ↗

IsJSONContentType reports whether contentType is application/json or a +json type.

(contentType string)

Source from the content-addressed store, hash-verified

82
83// IsJSONContentType reports whether contentType is application/json or a +json type.
84func IsJSONContentType(contentType string) bool {
85 mediaType, _, errParse := mime.ParseMediaType(strings.TrimSpace(contentType))
86 if errParse != nil {
87 mediaType = strings.TrimSpace(contentType)
88 }
89 mediaType = strings.ToLower(mediaType)
90 return mediaType == "application/json" || strings.HasSuffix(mediaType, "+json")
91}
92
93// LooksLikeJSON reports whether body starts with an object or array JSON marker.
94func LooksLikeJSON(body []byte) bool {

Callers 1

JSONBodyIfLikelyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected