MCPcopy
hub / github.com/ory/hydra / selectHeaderAccept

Function selectHeaderAccept

internal/httpclient/client.go:106–116  ·  view source on GitHub ↗

selectHeaderAccept join all accept types and return

(accepts []string)

Source from the content-addressed store, hash-verified

104
105// selectHeaderAccept join all accept types and return
106func selectHeaderAccept(accepts []string) string {
107 if len(accepts) == 0 {
108 return ""
109 }
110
111 if contains(accepts, "application/json") {
112 return "application/json"
113 }
114
115 return strings.Join(accepts, ",")
116}
117
118// contains is a case insensitive match, finding needle in a haystack
119func contains(haystack []string, needle string) bool {

Calls 1

containsFunction · 0.85

Tested by

no test coverage detected