mirror of
https://github.com/alibaba/higress.git
synced 2026-05-11 22:37:32 +08:00
test: allow specifying HTTP protocol (#822)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
This commit is contained in:
@@ -88,6 +88,7 @@ const (
|
||||
// values can be provided, as a comma-separated value.
|
||||
type Request struct {
|
||||
Host string
|
||||
Protocol string
|
||||
Method string
|
||||
Path string
|
||||
Headers map[string]string
|
||||
@@ -162,12 +163,10 @@ func MakeRequestAndExpectEventuallyConsistentResponse(t *testing.T, r roundtripp
|
||||
|
||||
var (
|
||||
scheme = "http"
|
||||
protocol = "HTTP"
|
||||
tlsConfig *roundtripper.TLSConfig
|
||||
)
|
||||
if expected.Request.ActualRequest.TLSConfig != nil {
|
||||
scheme = "https"
|
||||
protocol = "HTTPS"
|
||||
clientKeyPairs := make([]roundtripper.ClientKeyPair, 0, len(expected.Request.ActualRequest.TLSConfig.Certificates.ClientKeyPairs))
|
||||
for _, keyPair := range expected.Request.ActualRequest.TLSConfig.Certificates.ClientKeyPairs {
|
||||
clientKeyPairs = append(clientKeyPairs, roundtripper.ClientKeyPair{
|
||||
@@ -213,6 +212,11 @@ func MakeRequestAndExpectEventuallyConsistentResponse(t *testing.T, r roundtripp
|
||||
|
||||
path, query, _ := strings.Cut(expected.Request.ActualRequest.Path, "?")
|
||||
|
||||
protocol := "HTTP/1.1"
|
||||
if expected.Request.ActualRequest.Protocol != "" {
|
||||
protocol = expected.Request.ActualRequest.Protocol
|
||||
}
|
||||
|
||||
req := roundtripper.Request{
|
||||
Method: expected.Request.ActualRequest.Method,
|
||||
Host: expected.Request.ActualRequest.Host,
|
||||
|
||||
Reference in New Issue
Block a user