Skip to content

Commit 8a6fda5

Browse files
committed
refactor(mux): unexport the temporary QUERY method constant
1 parent 5796e95 commit 8a6fda5

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

mux_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,7 @@ func TestQueryHTTPMethod(t *testing.T) {
18181818
w.Write([]byte(fmt.Sprintf("query: %s", body)))
18191819
})
18201820

1821-
r.MethodFunc(MethodQuery, "/reports", func(w http.ResponseWriter, r *http.Request) {
1821+
r.MethodFunc("QUERY", "/reports", func(w http.ResponseWriter, r *http.Request) {
18221822
w.Write([]byte("reports"))
18231823
})
18241824

@@ -1829,16 +1829,16 @@ func TestQueryHTTPMethod(t *testing.T) {
18291829
ts := httptest.NewServer(r)
18301830
defer ts.Close()
18311831

1832-
if _, body := testRequest(t, ts, MethodQuery, "/search", bytes.NewReader([]byte("select 1"))); body != "query: select 1" {
1832+
if _, body := testRequest(t, ts, "QUERY", "/search", bytes.NewReader([]byte("select 1"))); body != "query: select 1" {
18331833
t.Fatal(body)
18341834
}
18351835
if _, body := testRequest(t, ts, "GET", "/search", nil); body != "get" {
18361836
t.Fatal(body)
18371837
}
1838-
if _, body := testRequest(t, ts, MethodQuery, "/reports", nil); body != "reports" {
1838+
if _, body := testRequest(t, ts, "QUERY", "/reports", nil); body != "reports" {
18391839
t.Fatal(body)
18401840
}
1841-
if _, body := testRequest(t, ts, MethodQuery, "/any", nil); body != "any" {
1841+
if _, body := testRequest(t, ts, "QUERY", "/any", nil); body != "any" {
18421842
t.Fatal(body)
18431843
}
18441844

tree.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ const (
3333
var mALL = mCONNECT | mDELETE | mGET | mHEAD |
3434
mOPTIONS | mPATCH | mPOST | mPUT | mQUERY | mTRACE
3535

36-
// MethodQuery is the HTTP QUERY method (RFC 10008), a safe, idempotent
36+
// methodQuery is the HTTP QUERY method (RFC 10008), a safe, idempotent
3737
// method that conveys a request body. It is defined here until net/http
38-
// provides an equivalent constant.
39-
const MethodQuery = "QUERY"
38+
// provides an equivalent constant, at which point this is a 1-1 swap.
39+
const methodQuery = "QUERY"
4040

4141
var methodMap = map[string]methodTyp{
4242
http.MethodConnect: mCONNECT,
@@ -47,7 +47,7 @@ var methodMap = map[string]methodTyp{
4747
http.MethodPatch: mPATCH,
4848
http.MethodPost: mPOST,
4949
http.MethodPut: mPUT,
50-
MethodQuery: mQUERY,
50+
methodQuery: mQUERY,
5151
http.MethodTrace: mTRACE,
5252
}
5353

@@ -60,7 +60,7 @@ var reverseMethodMap = map[methodTyp]string{
6060
mPATCH: http.MethodPatch,
6161
mPOST: http.MethodPost,
6262
mPUT: http.MethodPut,
63-
mQUERY: MethodQuery,
63+
mQUERY: methodQuery,
6464
mTRACE: http.MethodTrace,
6565
}
6666

0 commit comments

Comments
 (0)