Adding a simpler interface for the HTTP request library. (#8862)

This commit is contained in:
Amim Knabben 2022-09-05 08:02:36 -03:00 committed by GitHub
parent 79a311d3be
commit 12c9f00931
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 954 additions and 102 deletions

View file

@ -19,7 +19,8 @@ package defaultbackend
import (
"net/http"
"github.com/gavv/httpexpect/v2"
"k8s.io/ingress-nginx/test/e2e/framework/httpexpect"
"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
@ -64,15 +65,13 @@ var _ = framework.IngressNginxDescribe("[Default Backend]", func() {
for _, test := range testCases {
ginkgo.By(test.Name)
var req *httpexpect.Request
var req *httpexpect.HTTPRequest
switch test.Scheme {
case framework.HTTP:
req = f.HTTPTestClient().Request(test.Method, test.Path)
req.WithURL(f.GetURL(framework.HTTP) + test.Path)
req = f.HTTPTestClient().DoRequest(test.Method, test.Path).WithURL(f.GetURL(framework.HTTP) + test.Path)
case framework.HTTPS:
req = f.HTTPTestClient().Request(test.Method, test.Path)
req.WithURL(f.GetURL(framework.HTTPS) + test.Path)
req = f.HTTPTestClient().DoRequest(test.Method, test.Path).WithURL(f.GetURL(framework.HTTPS) + test.Path)
default:
ginkgo.Fail("Unexpected request scheme")
}