Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 1 | // Copyright 2018 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
khenaidoo | 7d3c558 | 2021-08-11 18:09:44 -0400 | [diff] [blame] | 5 | //go:build go1.11 |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 6 | // +build go1.11 |
| 7 | |
| 8 | package http2 |
| 9 | |
| 10 | import ( |
| 11 | "net/http/httptrace" |
| 12 | "net/textproto" |
| 13 | ) |
| 14 | |
| 15 | func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { |
| 16 | return trace != nil && trace.WroteHeaderField != nil |
| 17 | } |
| 18 | |
| 19 | func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) { |
| 20 | if trace != nil && trace.WroteHeaderField != nil { |
| 21 | trace.WroteHeaderField(k, []string{v}) |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error { |
| 26 | if trace != nil { |
| 27 | return trace.Got1xxResponse |
| 28 | } |
| 29 | return nil |
| 30 | } |