func (s *Scenario) AssertRequestHeader(headerKey string, headerValue string) error {
	if headerValues := s.CapturedRequest.Headers[headerKey]; headerValues == nil {
		return fmt.Errorf("expected request headers to contain %v but it only contained %v", headerKey, s.CapturedRequest.Headers)
	} else if headerValue != "*" {
		for _, value := range headerValues {
			if value == headerValue {
				return nil
			}
		}
		return fmt.Errorf("expected request headers %v to contain a %v value but it contained %v", headerKey, headerValue, headerValues)
	}
	return nil
}
AssertRequestHeader returns an error if the captured request headers do not contain the expected headerKey,
or if the matching request header value does not match the expected headerValue.
If the headerValue string equals `*`, the header value check is ignored.
package state
import (
	"fmt"
	"strings"
	"sigs.k8s.io/ingress-controller-conformance/test/http"
)
type Scenario struct {
	Namespace   string
	IngressName string
	SecretName string
	CapturedRequest  *http.CapturedRequest
	CapturedResponse *http.CapturedResponse
	IPOrFQDN string
}
func New() *Scenario {
	return &Scenario{}
}
func (s *Scenario) CaptureRoundTrip(method, scheme, hostname, path string) error {
	capturedRequest, capturedResponse, err := http.CaptureRoundTrip(method, scheme, hostname, path, s.IPOrFQDN)
	if err != nil {
		return err
	}
	s.CapturedRequest = capturedRequest
	s.CapturedResponse = capturedResponse
	return nil
}
func (s *Scenario) AssertStatusCode(statusCode int) error {
	if s.CapturedResponse.StatusCode != statusCode {
		return fmt.Errorf("expected status code %v but %v was returned", statusCode, s.CapturedResponse.StatusCode)
	}
	return nil
}
func (s *Scenario) AssertServedBy(service string) error {
	if s.CapturedRequest.Service != service {
		return fmt.Errorf("expected the request to be served by %v but it was served by %v", service, s.CapturedRequest.Service)
	}
	return nil
}
func (s *Scenario) AssertRequestHost(host string) error {
	if s.CapturedRequest.Host != host {
		return fmt.Errorf("expected the request host to be %v but was %v", host, s.CapturedRequest.Host)
	}
	return nil
}
func (s *Scenario) AssertTLSHostname(hostname string) error {
	if s.CapturedResponse.TLSHostname != hostname {
		return fmt.Errorf("expected the response TLS hostname to be %v but was %v", hostname, s.CapturedResponse.TLSHostname)
	}
	return nil
}
func (s *Scenario) AssertResponseProto(proto string) error {
	if s.CapturedResponse.Proto != proto {
		return fmt.Errorf("expected the response protocol to be %v but it was %v", proto, s.CapturedResponse.Proto)
	}
	return nil
}
func (s *Scenario) AssertRequestProto(proto string) error {
	if s.CapturedRequest.Proto != proto {
		return fmt.Errorf("expected the request protocol to be %v but it was %v", proto, s.CapturedRequest.Proto)
	}
	return nil
}
func (s *Scenario) AssertMethod(method string) error {
	if s.CapturedRequest.Method != method {
		return fmt.Errorf("expected the request method to be %v but it was %v", method, s.CapturedRequest.Method)
	}
	return nil
}
func (s *Scenario) AssertRequestPath(path string) error {
	if !strings.HasPrefix(path, "/") {
		path = fmt.Sprintf("/%s", path)
	}
	if s.CapturedRequest.Path != path {
		return fmt.Errorf("expected the request path to be %v but it was %v", path, s.CapturedRequest.Path)
	}
	return nil
}
func (s *Scenario) AssertResponseHeader(headerKey string, headerValue string) error {
	if headerValues := s.CapturedResponse.Headers[headerKey]; headerValues == nil {
		return fmt.Errorf("expected response headers to contain %v but it only contained %v", headerKey, s.CapturedResponse.Headers)
	} else if headerValue != "*" {
		for _, value := range headerValues {
			if value == headerValue {
				return nil
			}
		}
		return fmt.Errorf("expected response headers %v to contain a %v value but it contained %v", headerKey, headerValue, headerValues)
	}
	return nil
}