Skip to content

Commit

Permalink
use http.MethodGet
Browse files Browse the repository at this point in the history
  • Loading branch information
syntaqx committed Jun 28, 2024
1 parent 7754048 commit cbd4248
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions cookie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func TestSet(t *testing.T) {
_, err := http.NewRequest("GET", "/", nil)
_, err := http.NewRequest(http.MethodGet, "/", nil)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -68,7 +68,7 @@ func TestSet(t *testing.T) {
}
}
func TestGet(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
r := httptest.NewRequest(http.MethodGet, "/", nil)
cookieName := "myCookie"
cookieValue := "myValue"
cookie := &http.Cookie{
Expand All @@ -88,7 +88,7 @@ func TestGet(t *testing.T) {
}

func TestGetNonexistentCookie(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
r := httptest.NewRequest(http.MethodGet, "/", nil)
cookieName := "nonexistentCookie"

_, err := Get(r, cookieName)
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestRemove(t *testing.T) {
}

func TestPopulateFromCookies(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
r := httptest.NewRequest(http.MethodGet, "/", nil)
cookies := map[string]string{
"myCookie": "myValue",
"myIntCookie": "123",
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestPopulateFromCookies(t *testing.T) {
}

func TestPopulateFromCookies_InvalidIntValue(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
r := httptest.NewRequest(http.MethodGet, "/", nil)
r.AddCookie(&http.Cookie{
Name: "myIntCookie",
Value: "invalid",
Expand All @@ -215,7 +215,7 @@ func TestPopulateFromCookies_InvalidIntValue(t *testing.T) {
}

func TestPopulateFromCookies_InvalidBoolValue(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
r := httptest.NewRequest(http.MethodGet, "/", nil)
r.AddCookie(&http.Cookie{
Name: "myBoolCookie",
Value: "invalid",
Expand All @@ -233,7 +233,7 @@ func TestPopulateFromCookies_InvalidBoolValue(t *testing.T) {
}

func TestPopulateFromCookies_InvalidIntSliceValue(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
r := httptest.NewRequest(http.MethodGet, "/", nil)
r.AddCookie(&http.Cookie{
Name: "myIntSliceCookie",
Value: "1,2,invalid",
Expand All @@ -251,7 +251,7 @@ func TestPopulateFromCookies_InvalidIntSliceValue(t *testing.T) {
}

func TestPopulateFromCookies_InvalidUUIDValue(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
r := httptest.NewRequest(http.MethodGet, "/", nil)
r.AddCookie(&http.Cookie{
Name: "myUUIDCookie",
Value: "invalid",
Expand All @@ -269,7 +269,7 @@ func TestPopulateFromCookies_InvalidUUIDValue(t *testing.T) {
}

func TestPopulateFromCookies_InvalidTimeValue(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
r := httptest.NewRequest(http.MethodGet, "/", nil)
r.AddCookie(&http.Cookie{
Name: "myTimeCookie",
Value: "invalid",
Expand All @@ -287,7 +287,7 @@ func TestPopulateFromCookies_InvalidTimeValue(t *testing.T) {
}

func TestPopulateFromCookies_NotFound(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
r := httptest.NewRequest(http.MethodGet, "/", nil)
type MyStruct struct {
StringField string `cookie:"myCookie"`
}
Expand All @@ -304,7 +304,7 @@ func TestPopulateFromCookies_NotFound(t *testing.T) {
}

func TestPopulateFromCookies_UnsupportedType(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
r := httptest.NewRequest(http.MethodGet, "/", nil)
r.AddCookie(&http.Cookie{
Name: "myCookie",
Value: "myValue",
Expand Down

0 comments on commit cbd4248

Please sign in to comment.