MCPcopy Create free account
hub / github.com/imroc/req / foreachHeaderElement

Function foreachHeaderElement

http.go:125–139  ·  view source on GitHub ↗

foreachHeaderElement splits v according to the "#rule" construction in RFC 7230 section 7 and calls fn for each non-empty element.

(v string, fn func(string))

Source from the content-addressed store, hash-verified

123// foreachHeaderElement splits v according to the "#rule" construction
124// in RFC 7230 section 7 and calls fn for each non-empty element.
125func foreachHeaderElement(v string, fn func(string)) {
126 v = textproto.TrimString(v)
127 if v == "" {
128 return
129 }
130 if !strings.Contains(v, ",") {
131 fn(v)
132 return
133 }
134 for _, f := range strings.Split(v, ",") {
135 if f = textproto.TrimString(f); f != "" {
136 fn(f)
137 }
138 }
139}
140
141// maxPostHandlerReadBytes is the max number of Request.Body bytes not
142// consumed by a handler that the server will read from the client

Callers 1

fixTrailerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…