MCPcopy
hub / github.com/ory/kratos / IsJSONRequest

Function IsJSONRequest

x/isjsonrequest.go:15–18  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

13var defaultOffer = "text/html"
14
15func IsJSONRequest(r *http.Request) bool {
16 return httputil.NegotiateContentType(r, offers, defaultOffer) == "application/json" ||
17 r.Header.Get("Content-Type") == "application/json"
18}
19
20func IsBrowserRequest(r *http.Request) bool {
21 return httputil.NegotiateContentType(r, offers, defaultOffer) == "text/html"

Callers 15

onAuthenticatedMethod · 0.92
PostRegistrationHookMethod · 0.92
WriteFlowErrorMethod · 0.92
forwardMethod · 0.92
WriteFlowErrorMethod · 0.92
forwardMethod · 0.92
RegisterPublicRoutesMethod · 0.92
PostSettingsHookMethod · 0.92
reauthenticateMethod · 0.92
WriteFlowErrorMethod · 0.92

Calls 1

GetMethod · 0.45

Tested by 1