Enumeration values for supported compress Algorithms.
const (
GZIP = "gzip"
)
func AssertHasHeader(t T, expect, actual http.Header) bool
AssertHasHeader compares the header values and identifies if the actual header set includes all values specified in the expect set. Emits a testing error, and returns false if the headers are not equal.
func AssertHasHeaderKeys(t T, keys []string, actual http.Header) bool
AssertHasHeaderKeys validates that header set contains all keys expected. Emits a testing error, and returns false if the headers are not equal.
func AssertHasQuery(t T, expect, actual []QueryItem) bool
AssertHasQuery validates that the expected set of query items are present in the actual set. Emits a testing error, and returns false if any of the expected set are not found in the actual.
func AssertHasQueryKeys(t T, keys []string, actual []QueryItem) bool
AssertHasQueryKeys validates that the actual set of query items contains the keys provided. Emits a testing error if any key is not found.
func AssertJSONEqual(t T, expect, actual []byte) bool
AssertJSONEqual compares two JSON documents and identifies if the documents contain the same values. Emits a testing error, and returns false if the documents are not equal.
func AssertNotHaveHeaderKeys(t T, keys []string, actual http.Header) bool
AssertNotHaveHeaderKeys validates that header set does not contains any of the keys. Emits a testing error, and returns false if the header contains the any of the keys equal.
func AssertNotHaveQueryKeys(t T, keys []string, actual []QueryItem) bool
AssertNotHaveQueryKeys validates that the actual set of query items does not contains the keys provided. Emits a testing error if any key is found.
func AssertURLFormEqual(t T, expect, actual []byte) bool
AssertURLFormEqual compares two URLForm documents and identifies if the documents contain the same values. Emits a testing error, and returns false if the documents are not equal.
func AssertXMLEqual(t T, expect, actual []byte) bool
AssertXMLEqual compares two XML documents and identifies if the documents contain the same values. Emits a testing error, and returns false if the documents are not equal.
func CompareCompressedBytes(expect *bytes.Buffer, actual io.Reader, disable bool, min int64, algorithm string) error
CompareCompressedBytes compares the request stream before and after possible request compression
func CompareJSONReaderBytes(r io.Reader, expect []byte) error
CompareJSONReaderBytes compares the reader containing serialized JSON document. Deserializes the JSON documents to determine if they are equal. Return an error if the two JSON documents are not equal.
func CompareReaderBytes(r io.Reader, expect []byte) error
CompareReaderBytes compares the reader with the expected bytes. Returns an error if the two bytes are not equal.
func CompareReaderEmpty(r io.Reader) error
CompareReaderEmpty checks if the reader is nil, or contains no bytes. Returns an error if not empty.
func CompareReaders(expect, actual io.Reader) error
CompareReaders two io.Reader values together to determine if they are equal. Will read the contents of the readers until they are empty.
func CompareURLFormReaderBytes(r io.Reader, expect []byte) error
CompareURLFormReaderBytes compares the reader containing serialized URLForm document. Deserializes the URLForm documents to determine if they are equal. Return an error if the two URLForm documents are not equal.
func CompareValues(expect, actual interface{}, _ ...interface{}) error
CompareValues compares two values to determine if they are equal, specialized for comparison of SDK operation output types.
CompareValues expects the two values to be of the same underlying type. Doing otherwise will result in undefined behavior.
The third variadic argument is vestigial from a previous implementation that depended on go-cmp. Values passed therein have no effect.
func CompareXMLReaderBytes(r io.Reader, expect []byte) error
CompareXMLReaderBytes compares the reader with expected xml byte
func GzipCompareCompressBytes(expect []byte, actual io.Reader) error
func HasHeader(expect, actual http.Header) error
HasHeader compares the header values and identifies if the actual header set includes all values specified in the expect set. Returns an error if not.
func HasHeaderKeys(keys []string, actual http.Header) error
HasHeaderKeys validates that header set contains all keys expected. Returns an error if a header key is not in the header set.
func HasQuery(expect, actual []QueryItem) error
HasQuery validates that the expected set of query items are present in the actual set. Returns an error if any of the expected set are not found in the actual.
func HasQueryKeys(keys []string, actual []QueryItem) error
HasQueryKeys validates that the actual set of query items contains the keys provided. Returns an error if any key is not found.
func JSONEqual(expectBytes, actualBytes []byte) error
JSONEqual compares two JSON documents and identifies if the documents contain the same values. Returns an error if the two documents are not equal.
func NotHaveHeaderKeys(keys []string, actual http.Header) error
NotHaveHeaderKeys validates that header set does not contains any of the keys. Returns an error if a header key is found in the header set.
func NotHaveQueryKeys(keys []string, actual []QueryItem) error
NotHaveQueryKeys validates that the actual set of query items does not contain the keys provided. Returns an error if any key is found.
func URLFormEqual(expectBytes, actualBytes []byte) error
URLFormEqual compares two URLForm documents and identifies if the documents contain the same values. Returns an error if the two documents are not equal.
func XMLEqual(expectBytes, actualBytes []byte) error
XMLEqual asserts two xml documents by sorting the XML and comparing the strings It returns an error in case of mismatch or in case of malformed xml found while sorting. In case of mismatched XML, the error string will contain the diff between the two XMLs.
ByteLoop provides an io.ReadCloser that always fills the read byte slice with repeating value, until closed.
type ByteLoop struct {
// contains filtered or unexported fields
}
func (l *ByteLoop) Close() error
Close closes the ByteLoop, and prevents any further reading.
func (l *ByteLoop) Read(p []byte) (size int, err error)
Read populates the passed in byte slice with the value the ByteLoop was created with. Returns the size of bytes written. If the reader is closed, io.EOF will be returned.
QueryItem provides an escaped key and value struct for values from a raw query string.
type QueryItem struct { Key string Value string }
func ParseRawQuery(rawQuery string) (items []QueryItem)
ParseRawQuery returns a slice of QueryItems extracted from the raw query string. The parsed QueryItems preserve escaping of key and values.
All + escape characters are replaced with %20 for consistent escaping pattern.
T provides the testing interface for capturing failures with testing assert utilities.
type T interface { Error(args ...interface{}) Errorf(format string, args ...interface{}) Helper() }