Skip to content

Commit 0835e6a

Browse files
committed
Name change all Url to URL in URLQuery middleware.
1 parent 47e3183 commit 0835e6a

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

web/middleware/urlquery.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import (
55
"net/http"
66
)
77

8-
// UrlQueryKey is the context key for the URL Query
9-
const UrlQueryKey string = "urlquery"
8+
// URLQueryKey is the context key for the URL Query
9+
const URLQueryKey string = "urlquery"
1010

11-
// UrlQuery is a middleware to parse the URL Query parameters just once,
11+
// URLQuery is a middleware to parse the URL Query parameters just once,
1212
// and store the resulting url.Values in the context.
13-
func UrlQuery(c *web.C, h http.Handler) http.Handler {
13+
func URLQuery(c *web.C, h http.Handler) http.Handler {
1414
fn := func(w http.ResponseWriter, r *http.Request) {
1515
if c.Env == nil {
1616
c.Env = make(map[interface{}]interface{})
1717
}
18-
c.Env[UrlQueryKey] = r.URL.Query()
18+
c.Env[URLQueryKey] = r.URL.Query()
1919

2020
h.ServeHTTP(w, r)
2121
}

web/middleware/urlquery_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ import (
1010
"github.com/zenazn/goji/web"
1111
)
1212

13-
func testUrlQuery(r *http.Request, f func(*web.C, http.ResponseWriter, *http.Request)) *httptest.ResponseRecorder {
13+
func testURLQuery(r *http.Request, f func(*web.C, http.ResponseWriter, *http.Request)) *httptest.ResponseRecorder {
1414
var c web.C
1515

1616
h := func(w http.ResponseWriter, r *http.Request) {
1717
f(&c, w, r)
1818
}
19-
m := UrlQuery(&c, http.HandlerFunc(h))
19+
m := URLQuery(&c, http.HandlerFunc(h))
2020
w := httptest.NewRecorder()
2121
m.ServeHTTP(w, r)
2222

2323
return w
2424
}
2525

26-
func TestUrlQuery(t *testing.T) {
26+
func TestURLQuery(t *testing.T) {
2727
type testcase struct {
2828
url string
2929
expectedParams url.Values
@@ -39,11 +39,11 @@ func TestUrlQuery(t *testing.T) {
3939

4040
for _, tc := range testcases {
4141
r, _ := http.NewRequest("GET", tc.url, nil)
42-
testUrlQuery(r,
42+
testURLQuery(r,
4343
func(c *web.C, w http.ResponseWriter, r *http.Request) {
44-
params := c.Env[UrlQueryKey].(url.Values)
44+
params := c.Env[URLQueryKey].(url.Values)
4545
if !reflect.DeepEqual(params, tc.expectedParams) {
46-
t.Errorf("GET %s, UrlQuery middleware found %v, should be %v", tc.url, params, tc.expectedParams)
46+
t.Errorf("GET %s, URLQuery middleware found %v, should be %v", tc.url, params, tc.expectedParams)
4747
}
4848

4949
w.Write([]byte{'h', 'i'})

0 commit comments

Comments
 (0)