echo

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	URLFieldRegex     = regexp.MustCompile(string(URLField) + "=(.*)")
	ClusterFieldRegex = regexp.MustCompile(string(ClusterField) + "=(.*)")
	IPFieldRegex      = regexp.MustCompile(string(IPField) + "=(.*)")
)

Functions

This section is empty.

Types

type Field

type Field string

Field is a list of fields returned in responses from the Echo server.

const (
	RequestIDField        Field = "X-Request-Id"
	ServiceVersionField   Field = "ServiceVersion"
	ServicePortField      Field = "ServicePort"
	StatusCodeField       Field = "StatusCode"
	URLField              Field = "URL"
	ForwarderURLField     Field = "Url"
	ForwarderMessageField Field = "Echo"
	ForwarderHeaderField  Field = "Header"
	HostField             Field = "Host"
	HostnameField         Field = "Hostname"
	MethodField           Field = "Method"
	ProtocolField         Field = "Proto"
	AlpnField             Field = "Alpn"
	RequestHeaderField    Field = "RequestHeader"
	ResponseHeaderField   Field = "ResponseHeader"
	ClusterField          Field = "Cluster"
	IPField               Field = "IP" // The Requester’s IP Address.
	LatencyField          Field = "Latency"
	ActiveRequestsField   Field = "ActiveRequests"
	DNSProtocolField      Field = "Protocol"
	DNSQueryField         Field = "Query"
	DNSServerField        Field = "DnsServer"
	CipherField           Field = "Cipher"
	TLSVersionField       Field = "Version"
	TLSServerName         Field = "ServerName"
)

type HeaderType

type HeaderType string

HeaderType is a helper enum for retrieving Headers from a Response.

const (
	RequestHeader  HeaderType = "request"
	ResponseHeader HeaderType = "response"
)

type MeshApplication

type MeshApplication string
const (
	MeshAppEchoV1 MeshApplication = "app=echo,version=v1"
	MeshAppEchoV2 MeshApplication = "app=echo,version=v2"
)

type MeshPod

type MeshPod struct {
	Name      string
	Namespace string
	Address   string
	// contains filtered or unexported fields
}

MeshPod represents a connection to a specific pod running in the mesh. This can be used to trigger requests *from* that pod.

func ConnectToAppInNamespace added in v0.8.0

func ConnectToAppInNamespace(t *testing.T, s *suite.ConformanceTestSuite, app MeshApplication, ns string) MeshPod

func (*MeshPod) MakeRequestAndExpectEventuallyConsistentResponse

func (m *MeshPod) MakeRequestAndExpectEventuallyConsistentResponse(t *testing.T, exp http.ExpectedResponse, timeoutConfig config.TimeoutConfig)

type Response

type Response struct {
	// RequestURL is the requested URL. This differs from URL, which is the just the path.
	// For example, RequestURL=http://foo/bar, URL=/bar
	RequestURL string
	// Method used (for HTTP).
	Method string
	// Protocol used for the request.
	Protocol string
	// Alpn value (for HTTP).
	Alpn string
	// RawContent is the original unparsed content for this response
	RawContent string
	// ID is a unique identifier of the resource in the response
	ID string
	// URL is the url the request is sent to
	URL string
	// Version is the version of the resource in the response
	Version string
	// Port is the port of the resource in the response
	Port string
	// Code is the response code
	Code string
	// Host is the host called by the request
	Host string
	// Hostname is the host that responded to the request
	Hostname string
	// The cluster where the server is deployed.
	Cluster string
	// IP is the requester's ip address
	IP string

	RequestHeaders  http.Header
	ResponseHeaders http.Header
	// contains filtered or unexported fields
}

Response represents a response to a single echo request.

func ParseResponse

func ParseResponse(output string) Response

func (Response) Body

func (r Response) Body() []string

Body returns the lines of the response body, in order

func (Response) GetHeaders

func (r Response) GetHeaders(hType HeaderType) http.Header

GetHeaders returns the appropriate headers for the given type.

func (Response) String

func (r Response) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL