getHeaderFieldVals returns the field values for the given fieldName from input. The host parameter should be obtained from the http.Request.Host field, and the transferEncoding from http.Request.TransferEncoding, since net/http removes them from the header map.
(input http.Header, fieldName, host string, transferEncoding []string)
| 1025 | // transferEncoding from http.Request.TransferEncoding, since net/http removes them |
| 1026 | // from the header map. |
| 1027 | func getHeaderFieldVals(input http.Header, fieldName, host string, transferEncoding []string) []string { |
| 1028 | fieldName = textproto.CanonicalMIMEHeaderKey(fieldName) |
| 1029 | if fieldName == "Host" && host != "" { |
| 1030 | return []string{host} |
| 1031 | } |
| 1032 | if fieldName == "Transfer-Encoding" && input[fieldName] == nil { |
| 1033 | return transferEncoding |
| 1034 | } |
| 1035 | return input[fieldName] |
| 1036 | } |
| 1037 | |
| 1038 | // matchHeaders returns true if input matches the criteria in against without regex. |
| 1039 | // The host parameter should be obtained from the http.Request.Host field since |
no outgoing calls
no test coverage detected