Skip to content

Commit

Permalink
fix(tests): update error message and test URL in proxy tests
Browse files Browse the repository at this point in the history
Updated the test URL to simulate a more realistic failing case. Adjusted the expected error message to match the server's response for improved clarity and alignment with current behavior.
  • Loading branch information
ryanbekhen committed Jan 23, 2025
1 parent cbe180a commit 2e72156
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/httpproxy/httpproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ func TestServer_ServeHTTP(t *testing.T) {
})

t.Run("Handle HTTP - failed to resolve host", func(t *testing.T) {
req := httptest.NewRequest(http.MethodGet, "http://invalidhost.com", nil)
req := httptest.NewRequest(http.MethodGet, "http://invalidhostinvalidhostinvalidhost.com", nil)
req.Header.Set("Proxy-Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte("user:password")))
rr := httptest.NewRecorder()

server.ServeHTTP(rr, req)

assert.Equal(t, http.StatusBadGateway, rr.Code)
assert.Contains(t, rr.Body.String(), "Bad gateway: failed to resolve destination")
assert.Contains(t, rr.Body.String(), "Bad gateway: failed to send request")
})
}

Expand Down

0 comments on commit 2e72156

Please sign in to comment.