MCPcopy Create free account
hub / github.com/WICG/webpackage / normalizeHeaderValues

Function normalizeHeaderValues

go/bundle/encoder.go:22–38  ·  view source on GitHub ↗
(values []string)

Source from the content-addressed store, hash-verified

20const maxNumVariantsForSingleURL = 10000
21
22func normalizeHeaderValues(values []string) string {
23 // RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1
24 // 4.2 Message Headers
25 // https://tools.ietf.org/html/rfc2616#section-4.2
26 //
27 // Multiple message-header fields with the same field-name MAY be
28 // present in a message if and only if the entire field-value for that
29 // header field is defined as a comma-separated list [i.e., #(values)].
30 // It MUST be possible to combine the multiple header fields into one
31 // "field-name: field-value" pair, without changing the semantics of the
32 // message, by appending each subsequent field-value to the first, each
33 // separated by a comma. The order in which header fields with the same
34 // field-name are received is therefore significant to the
35 // interpretation of the combined field value, and thus a proxy MUST NOT
36 // change the order of these field values when a message is forwarded.
37 return strings.Join(values, ",")
38}
39
40func (r Response) EncodeHeader() ([]byte, error) {
41 var b bytes.Buffer

Callers 2

EncodeHeaderMethod · 0.70
addExchangeMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected