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

Function JSONBodyIfLikely

internal/htmlsanitize/htmlsanitize.go:54–59  ·  view source on GitHub ↗

JSONBodyIfLikely escapes JSON bodies when the content type or body shape indicates JSON.

(body []byte, contentType string)

Source from the content-addressed store, hash-verified

52
53// JSONBodyIfLikely escapes JSON bodies when the content type or body shape indicates JSON.
54func JSONBodyIfLikely(body []byte, contentType string) ([]byte, bool) {
55 if IsJSONContentType(contentType) || LooksLikeJSON(body) {
56 return JSONBody(body)
57 }
58 return body, false
59}
60
61// JSONValue recursively escapes string values in JSON-compatible data.
62func JSONValue(value any) any {

Calls 3

IsJSONContentTypeFunction · 0.85
LooksLikeJSONFunction · 0.85
JSONBodyFunction · 0.85

Tested by 1