Overview of httpexpect
masterhttpexpect is a declarative, chainable testing library for Go (golang) designed for end-to-end HTTP and REST API testing. It provides builders to construct HTTP requests and assertions to validate HTTP responses and their payloads.
Key capabilities include:
- Request Building: Construct URLs with interpolation, manage query parameters, headers, cookies, and various payload types (JSON, urlencoded, multipart, plain text).
- Response Assertions: Validate status codes, headers, cookies, and payloads (JSON, JSONP, forms, text).
- Payload Inspection: Recursive inspection of payloads with support for type-specific assertions (object, array, string, number, boolean, null, datetime, duration, cookie), regex, JSONPath queries, and JSON Schema validation.
- WebSocket Support: Upgrade HTTP connections to WebSockets and interact with WebSocket servers.
- Flexible Execution: Tests can communicate via a real HTTP client or by invoking
net/httporfasthttphandlers directly.