selectHeaderAccept join all accept types and return
(accepts []string)
| 104 | |
| 105 | // selectHeaderAccept join all accept types and return |
| 106 | func 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 |
| 119 | func contains(haystack []string, needle string) bool { |
no test coverage detected