Skip to content

Commit da0fad3

Browse files
committed
fix tests
1 parent 92b6c5e commit da0fad3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

decode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,5 +250,5 @@ func fillValues(sv reflect.Value, opts tagOptions, valArr []string) error {
250250
}
251251

252252
func headerValues(h http.Header, key string) []string {
253-
return textproto.MIMEHeader(h).Values(key)
253+
return textproto.MIMEHeader(h)[textproto.CanonicalMIMEHeaderKey(key)]
254254
}

decode_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package httpheader
33
import (
44
"fmt"
55
"net/http"
6+
"net/textproto"
67
"reflect"
78
"regexp"
89
"sort"
@@ -84,11 +85,11 @@ func TestDecodeHeader(t *testing.T) {
8485
type DecodedArgs []string
8586

8687
func (m *DecodedArgs) DecodeHeader(header http.Header, tagKey string) error {
87-
baseKey := http.CanonicalHeaderKey(tagKey)
88+
baseKey := textproto.CanonicalMIMEHeaderKey(tagKey)
8889
keyMatch := regexp.MustCompile(fmt.Sprintf(`^%s\.\d+$`, baseKey))
8990
var args DecodedArgs
9091
for k := range header {
91-
if keyMatch.MatchString(http.CanonicalHeaderKey(k)) {
92+
if keyMatch.MatchString(textproto.CanonicalMIMEHeaderKey(k)) {
9293
args = append(args, header.Get(k))
9394
}
9495
}

0 commit comments

Comments
 (0)