|
@@ -23,7 +23,7 @@ func TestBoolValue(t *testing.T) {
|
|
|
for c, e := range cases {
|
|
|
v := url.Values{}
|
|
|
v.Set("test", c)
|
|
|
- r, _ := http.NewRequest("POST", "", nil)
|
|
|
+ r, _ := http.NewRequest(http.MethodPost, "", nil)
|
|
|
r.Form = v
|
|
|
|
|
|
a := BoolValue(r, "test")
|
|
@@ -34,14 +34,14 @@ func TestBoolValue(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
func TestBoolValueOrDefault(t *testing.T) {
|
|
|
- r, _ := http.NewRequest("GET", "", nil)
|
|
|
+ r, _ := http.NewRequest(http.MethodGet, "", nil)
|
|
|
if !BoolValueOrDefault(r, "queryparam", true) {
|
|
|
t.Fatal("Expected to get true default value, got false")
|
|
|
}
|
|
|
|
|
|
v := url.Values{}
|
|
|
v.Set("param", "")
|
|
|
- r, _ = http.NewRequest("GET", "", nil)
|
|
|
+ r, _ = http.NewRequest(http.MethodGet, "", nil)
|
|
|
r.Form = v
|
|
|
if BoolValueOrDefault(r, "param", true) {
|
|
|
t.Fatal("Expected not to get true")
|
|
@@ -59,7 +59,7 @@ func TestInt64ValueOrZero(t *testing.T) {
|
|
|
for c, e := range cases {
|
|
|
v := url.Values{}
|
|
|
v.Set("test", c)
|
|
|
- r, _ := http.NewRequest("POST", "", nil)
|
|
|
+ r, _ := http.NewRequest(http.MethodPost, "", nil)
|
|
|
r.Form = v
|
|
|
|
|
|
a := Int64ValueOrZero(r, "test")
|
|
@@ -79,7 +79,7 @@ func TestInt64ValueOrDefault(t *testing.T) {
|
|
|
for c, e := range cases {
|
|
|
v := url.Values{}
|
|
|
v.Set("test", c)
|
|
|
- r, _ := http.NewRequest("POST", "", nil)
|
|
|
+ r, _ := http.NewRequest(http.MethodPost, "", nil)
|
|
|
r.Form = v
|
|
|
|
|
|
a, err := Int64ValueOrDefault(r, "test", -1)
|
|
@@ -95,7 +95,7 @@ func TestInt64ValueOrDefault(t *testing.T) {
|
|
|
func TestInt64ValueOrDefaultWithError(t *testing.T) {
|
|
|
v := url.Values{}
|
|
|
v.Set("test", "invalid")
|
|
|
- r, _ := http.NewRequest("POST", "", nil)
|
|
|
+ r, _ := http.NewRequest(http.MethodPost, "", nil)
|
|
|
r.Form = v
|
|
|
|
|
|
_, err := Int64ValueOrDefault(r, "test", -1)
|