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))
| 2473 | // foreachHeaderElement splits v according to the "#rule" construction |
| 2474 | // in RFC 7230 section 7 and calls fn for each non-empty element. |
| 2475 | func foreachHeaderElement(v string, fn func(string)) { |
| 2476 | v = textproto.TrimString(v) |
| 2477 | if v == "" { |
| 2478 | return |
| 2479 | } |
| 2480 | if !strings.Contains(v, ",") { |
| 2481 | fn(v) |
| 2482 | return |
| 2483 | } |
| 2484 | for _, f := range strings.Split(v, ",") { |
| 2485 | if f = textproto.TrimString(f); f != "" { |
| 2486 | fn(f) |
| 2487 | } |
| 2488 | } |
| 2489 | } |
| 2490 | |
| 2491 | // may return error types nil, or ConnectionError. Any other error value |
| 2492 | // is a StreamError of type ErrCodeProtocol. The returned error in that case |
no outgoing calls
no test coverage detected
searching dependent graphs…