selectHeaderContentType select a content type from the available list.
(contentTypes []string)
| 93 | |
| 94 | // selectHeaderContentType select a content type from the available list. |
| 95 | func 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 |
| 106 | func selectHeaderAccept(accepts []string) string { |
no test coverage detected