Categorygithub.com/hidevopsio/httpexpect
modulepackage
0.0.0-20240811100504-92ed99bc8bec
Repository: https://github.com/hidevopsio/httpexpect.git
Documentation: pkg.go.dev

# README

HTTPExpect

The underline test framework that iris/httptest is built on.

Build status

Clone of gavv/httpexpect, remove unused features in order to reduce the overall disk size.

# Functions

New returns a new Expect object.
NewArray returns a new Array given a reporter used to report failures and value to be inspected.
NewAssertReporter returns a new AssertReporter object.
NewBinder returns a new Binder given a http.Handler.
NewBoolean returns a new Boolean given a reporter used to report failures and value to be inspected.
NewCompactPrinter returns a new CompactPrinter given a logger.
NewCookie returns a new Cookie object given a reporter used to report failures and cookie value to be inspected.
NewCurlPrinter returns a new CurlPrinter given a logger.
NewDateTime returns a new DateTime object given a reporter used to report failures and time.Time value to be inspected.
NewDebugPrinter returns a new DebugPrinter given a logger and body flag.
NewJar returns a new http.CookieJar.
NewMatch returns a new Match object given a reporter used to report failures and submatches to be inspected.
NewNumber returns a new Number given a reporter used to report failures and value to be inspected.
NewObject returns a new Object given a reporter used to report failures and value to be inspected.
NewRequest returns a new Request object.
NewRequireReporter returns a new RequireReporter object.
NewResponse returns a new Response given a reporter used to report failures and http.Response to be inspected.
NewString returns a new String given a reporter used to report failures and value to be inspected.
NewValue returns a new Value given a reporter used to report failures and value to be inspected.
WithConfig returns a new Expect object with given config.

# Constants

Status1xx defines "Informational" status codes.
Status2xx defines "Success" status codes.
Status3xx defines "Redirection" status codes.
Status4xx defines "Client Error" status codes.
Status5xx defines "Server Error" status codes.

# Structs

Array provides methods to inspect attached []interface{} object (Go representation of JSON array).
AssertReporter implements Reporter interface using `testify/assert' package.
Binder implements networkless http.RoundTripper attached directly to http.Handler.
Boolean provides methods to inspect attached bool value (Go representation of JSON boolean).
CompactPrinter implements Printer.
Config contains various settings.
Cookie provides methods to inspect attached http.Cookie value.
CurlPrinter implements Printer.
DateTime provides methods to inspect attached time.Time value.
DebugPrinter implements Printer.
DefaultRequestFactory is the default RequestFactory implementation which just calls http.NewRequest.
Expect is a toplevel object that contains user Config and allows to construct Request objects.
Match provides methods to inspect attached regexp match results.
Number provides methods to inspect attached float64 value (Go representation of JSON number).
Object provides methods to inspect attached map[string]interface{} object (Go representation of JSON object).
Request provides methods to incrementally build http.Request object, send it, and receive response.
RequireReporter implements Reporter interface using `testify/require' package.
Response provides methods to inspect attached http.Response object.
String provides methods to inspect attached string value (Go representation of JSON string).
Value provides methods to inspect attached interface{} object (Go representation of arbitrary JSON value) and cast it to concrete type.

# Interfaces

Client is used to send http.Request and receive http.Response.
Logger is used as output backend for Printer.
LoggerReporter combines Logger and Reporter interfaces.
Printer is used to print requests and responses.
Reporter is used to report failures.
RequestFactory is used to create all http.Request objects.

# Type aliases

StatusRange is enum for response status ranges.