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

Function selectHeaderContentType

internal/httpclient/client.go:95–103  ·  view source on GitHub ↗

selectHeaderContentType select a content type from the available list.

(contentTypes []string)

Source from the content-addressed store, hash-verified

93
94// selectHeaderContentType select a content type from the available list.
95func selectHeaderContentType(contentTypes []string) string {
96 if len(contentTypes) == 0 {
97 return ""
98 }
99 if contains(contentTypes, "application/json") {
100 return "application/json"
101 }
102 return contentTypes[0] // use the first content type specified in 'consumes'
103}
104
105// selectHeaderAccept join all accept types and return
106func selectHeaderAccept(accepts []string) string {

Calls 1

containsFunction · 0.85

Tested by

no test coverage detected