Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ResponseTypeKey is the key for the response type in the request. // This can be either empty, "sse", or "aws-event-stream". // * If this is "sse", the response body is expected to be a Server-Sent Event stream. // Each line in x-response-body is treated as a separate [data] payload. // * If this is "aws-event-stream", the response body is expected to be an AWS Event Stream. // Each line in x-response-body is treated as a separate event payload. // * If this is gzip, the response body is expected to be a regular JSON response compressed with gzip. // * If this is empty, the response body is expected to be a regular JSON response. ResponseTypeKey = "x-response-type" // ExpectedHeadersKey is the key for the expected headers in the request. // The value is a base64 encoded string of comma separated key-value pairs. // E.g. "key1:value1,key2:value2". ExpectedHeadersKey = "x-expected-headers" // ExpectedPathHeaderKey is the key for the expected path in the request. // The value is a base64 encoded. ExpectedPathHeaderKey = "x-expected-path" // ExpectedRawQueryHeaderKey is the key for the expected raw query in the request. // E.g. "key1=value1&key2=value2". ExpectedRawQueryHeaderKey = "x-expected-raw-query" // ExpectedRequestBodyHeaderKey is the key for the expected request body in the request. // The value is a base64 encoded. ExpectedRequestBodyHeaderKey = "x-expected-request-body" // ResponseStatusKey is the key for the response status in the response, default is 200 if not set. ResponseStatusKey = "x-response-status" // ResponseHeadersKey is the key for the response headers in the response. // The value is a base64 encoded string of comma separated key-value pairs. // E.g. "key1:value1,key2:value2". ResponseHeadersKey = "x-response-headers" // ResponseBodyHeaderKey is the key for the response body in the response. // The value is a base64 encoded. ResponseBodyHeaderKey = "x-response-body" // NonExpectedRequestHeadersKey is the key for the non-expected request headers. // The value is a base64 encoded string of comma separated header keys expected to be absent. NonExpectedRequestHeadersKey = "x-non-expected-request-headers" // ExpectedTestUpstreamIDKey is the key for the expected testupstream-id in the request, // and the value will be compared with the TESTUPSTREAM_ID environment variable. // If the values do not match, the request will be rejected, meaning that the request // was routed to the wrong upstream. ExpectedTestUpstreamIDKey = "x-expected-testupstream-id" // ExpectedHostKey is the key for the expected host in the request. ExpectedHostKey = "x-expected-host" // FakeResponseHeaderKey is the key to trigger a fake response body. // // The value must be either "small", "medium" or "large". FakeResponseHeaderKey = "x-fake-response" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶ added in v0.5.0
type Server struct {
// ID is the identifier of the test upstream server that can be used to verify routing.
ID string
// Logger is the logger used to log messages.
Logger *log.Logger
// contains filtered or unexported fields
}
Server is a test upstream server that responds with the expected content and headers. It also checks if the request content matches the expected headers, path, and body.
Click to show internal directories.
Click to hide internal directories.