...

Package roundtripper

import "sigs.k8s.io/gateway-api/conformance/utils/roundtripper"
Overview
Index

Overview ▾

Constants

const (
    H2CPriorKnowledgeProtocol = "H2C_PRIOR_KNOWLEDGE"
)

func IsRedirect

func IsRedirect(statusCode int) bool

IsRedirect returns true if a given status code is a redirect code.

func IsTimeoutError

func IsTimeoutError(statusCode int) bool

IsTimeoutError returns true if a given status code is a timeout error code.

type CapturedRequest

CapturedRequest contains request metadata captured from an echoserver response.

type CapturedRequest struct {
    Path     string              `json:"path"`
    Host     string              `json:"host"`
    Method   string              `json:"method"`
    Protocol string              `json:"proto"`
    Headers  map[string][]string `json:"headers"`

    Namespace string `json:"namespace"`
    Pod       string `json:"pod"`
}

type CapturedResponse

CapturedResponse contains response metadata.

type CapturedResponse struct {
    StatusCode      int
    ContentLength   int64
    Protocol        string
    Headers         map[string][]string
    RedirectRequest *RedirectRequest
}

type DefaultRoundTripper

DefaultRoundTripper is the default implementation of a RoundTripper. It will be used if a custom implementation is not specified.

type DefaultRoundTripper struct {
    Debug             bool
    TimeoutConfig     config.TimeoutConfig
    CustomDialContext func(context.Context, string, string) (net.Conn, error)
}

func (*DefaultRoundTripper) CaptureRoundTrip

func (d *DefaultRoundTripper) CaptureRoundTrip(request Request) (*CapturedRequest, *CapturedResponse, error)

CaptureRoundTrip makes a request with the provided parameters and returns the captured request and response from echoserver. An error will be returned if there is an error running the function but not if an HTTP error status code is received.

type RedirectRequest

RedirectRequest contains a follow up request metadata captured from a redirect response.

type RedirectRequest struct {
    Scheme string
    Host   string
    Port   string
    Path   string
}

type Request

Request is the primary input for making a request.

type Request struct {
    URL              url.URL
    Host             string
    Protocol         string
    Method           string
    Headers          map[string][]string
    UnfollowRedirect bool
    CertPem          []byte
    KeyPem           []byte
    Server           string
}

func (Request) String

func (r Request) String() string

String returns a printable version of Request for logging. Note that the CertPem and KeyPem are truncated.

type RoundTripper

RoundTripper is an interface used to make requests within conformance tests. This can be overridden with custom implementations whenever necessary.

type RoundTripper interface {
    CaptureRoundTrip(Request) (*CapturedRequest, *CapturedResponse, error)
}