From 70e04706d8ccd4c93de54e1f5c7b15c942018dee Mon Sep 17 00:00:00 2001 From: Jonathan Amsterdam Date: Fri, 22 Sep 2023 16:11:36 -0400 Subject: [PATCH] net/http: remove unused function Change-Id: I4364d94663282249e632d12026a810147844ad2e Reviewed-on: https://go-review.googlesource.com/c/go/+/530615 Run-TryBot: Jonathan Amsterdam TryBot-Result: Gopher Robot Reviewed-by: Damien Neil --- src/net/http/pattern.go | 14 -------------- src/net/http/pattern_test.go | 20 -------------------- 2 files changed, 34 deletions(-) diff --git a/src/net/http/pattern.go b/src/net/http/pattern.go index 0c8644d9cd..f6af19b0f4 100644 --- a/src/net/http/pattern.go +++ b/src/net/http/pattern.go @@ -180,20 +180,6 @@ func parsePattern(s string) (_ *pattern, err error) { return p, nil } -// TODO(jba): remove this; it is unused. -func isValidHTTPToken(s string) bool { - if s == "" { - return false - } - // See https://www.rfc-editor.org/rfc/rfc9110#section-5.6.2. - for _, r := range s { - if !unicode.IsLetter(r) && !unicode.IsDigit(r) && !strings.ContainsRune("!#$%&'*+.^_`|~-", r) { - return false - } - } - return true -} - func isValidWildcardName(s string) bool { if s == "" { return false diff --git a/src/net/http/pattern_test.go b/src/net/http/pattern_test.go index b219648f33..f0c84d243e 100644 --- a/src/net/http/pattern_test.go +++ b/src/net/http/pattern_test.go @@ -145,26 +145,6 @@ func (p1 *pattern) equal(p2 *pattern) bool { slices.Equal(p1.segments, p2.segments) } -func TestIsValidHTTPToken(t *testing.T) { - for _, test := range []struct { - in string - want bool - }{ - {"", false}, - {"GET", true}, - {"get", true}, - {"white space", false}, - {"#!~", true}, - {"a-b1_2", true}, - {"notok)", false}, - } { - got := isValidHTTPToken(test.in) - if g, w := got, test.want; g != w { - t.Errorf("%q: got %t, want %t", test.in, g, w) - } - } -} - func mustParsePattern(tb testing.TB, s string) *pattern { tb.Helper() p, err := parsePattern(s) -- 2.50.0