Skip to content

Commit

Permalink
lint: http nil body
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Nov 26, 2023
1 parent d84895b commit 519552c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/proxy/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func Test_limitRemoteIPs(t *testing.T) {

t.Run("no limits", func(t *testing.T) {
recorder := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/", nil)
req, err := http.NewRequest("GET", "/", http.NoBody)
require.NoError(t, err)

handler.ServeHTTP(recorder, req)
Expand All @@ -266,7 +266,7 @@ func Test_limitRemoteIPs(t *testing.T) {

t.Run("limit single ip, passed", func(t *testing.T) {
recorder := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/", nil)
req, err := http.NewRequest("GET", "/", http.NoBody)
require.NoError(t, err)

m := discovery.MatchedRoute{Mapper: discovery.URLMapper{OnlyFromIPs: []string{"127.0.0.1"}}}
Expand All @@ -284,7 +284,7 @@ func Test_limitRemoteIPs(t *testing.T) {

t.Run("limit from multi, passed", func(t *testing.T) {
recorder := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/", nil)
req, err := http.NewRequest("GET", "/", http.NoBody)
require.NoError(t, err)

m := discovery.MatchedRoute{Mapper: discovery.URLMapper{OnlyFromIPs: []string{"127.0.0.0/24", "192.168.1.1"}}}
Expand All @@ -302,7 +302,7 @@ func Test_limitRemoteIPs(t *testing.T) {

t.Run("limit single ip, failed", func(t *testing.T) {
recorder := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/", nil)
req, err := http.NewRequest("GET", "/", http.NoBody)
require.NoError(t, err)
req.Header.Set("X-Real-IP", "127.0.0.2")

Expand All @@ -320,7 +320,7 @@ func Test_limitRemoteIPs(t *testing.T) {

t.Run("limit from multi, failed", func(t *testing.T) {
recorder := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/", nil)
req, err := http.NewRequest("GET", "/", http.NoBody)
require.NoError(t, err)

m := discovery.MatchedRoute{Mapper: discovery.URLMapper{OnlyFromIPs: []string{"127.1.0.0/24", "192.168.1.1"}}}
Expand Down

0 comments on commit 519552c

Please sign in to comment.