Skip to content

Commit

Permalink
chore: use httptest.NewRequest instead of http.Request as incoming se…
Browse files Browse the repository at this point in the history
…rver request
  • Loading branch information
ronething committed Dec 8, 2022
1 parent de9f84f commit e77baf4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/api/router/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ func TestApisixHealthz(t *testing.T) {
func TestMetrics(t *testing.T) {
w := httptest.NewRecorder()
c, r := gin.CreateTestContext(w)
req, err := http.NewRequest("GET", "/metrics", nil)
assert.Nil(t, err, nil)
req := httptest.NewRequest("GET", "/metrics", nil)
c.Request = req
mountMetrics(r)
metrics(c)
Expand All @@ -72,8 +71,7 @@ func TestMetrics(t *testing.T) {
func TestWebhooks(t *testing.T) {
w := httptest.NewRecorder()
c, r := gin.CreateTestContext(w)
req, err := http.NewRequest("POST", "/validation", nil)
assert.Nil(t, err, nil)
req := httptest.NewRequest("POST", "/validation", nil)
c.Request = req
MountWebhooks(r, &apisix.ClusterOptions{})

Expand Down

0 comments on commit e77baf4

Please sign in to comment.