Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 1.0% on proxy.golang.org
Top 0.3% dependent packages on proxy.golang.org
Top 0.3% dependent repos on proxy.golang.org
Top 1.9% forks on proxy.golang.org
Top 1.4% docker downloads on proxy.golang.org

proxy.golang.org : github.com/gavv/httpexpect/v2

Package httpexpect helps with end-to-end HTTP and REST API testing. See example directory: There are two common ways to test API with httpexpect: The second approach works only if the server is a Go module and its handler can be imported in tests. Concrete behaviour is determined by Client implementation passed to Config struct. If you're using http.Client, set its Transport field (http.RoundTriper) to one of the following: Note that http handler can be usually obtained from http framework you're using. E.g., echo framework provides either http.Handler or fasthttp.RequestHandler. You can also provide your own implementation of RequestFactory (creates http.Request), or Client (gets http.Request and returns http.Response). If you're starting server from tests, it's very handy to use net/http/httptest. Whenever values are checked for equality in httpexpect, they are converted to "canonical form": This is equivalent to subsequently json.Marshal() and json.Unmarshal() the value and currently is implemented so. When some check fails, failure is reported. If non-fatal failures are used (see Reporter interface), execution is continued and instance that was checked is marked as failed. If specific instance is marked as failed, all subsequent checks are ignored for this instance and for any child instances retrieved after failure. Example: If you want to be informed about every asserion made, successful or failed, you can use AssertionHandler interface. Default implementation of this interface ignores successful assertions and reports failed assertions using Formatter and Reporter objects. Custom AssertionHandler can handle all assertions (e.g. dump them in JSON format) and is free to use or not to use Formatter and Reporter in its sole discretion.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/gavv/httpexpect/v2
Keywords: assertions, hacktoberfest, http, json, rest, testing, websocket
License: MIT
Latest release: 7 months ago
First release: over 1 year ago
Namespace: github.com/gavv/httpexpect
Dependent packages: 236
Dependent repositories: 602
Stars: 2,146 on GitHub
Forks: 211 on GitHub
Docker dependents: 5
Docker downloads: 76
See more repository details: repos.ecosyste.ms
Funding links: https://liberapay.com/gavv, https://www.paypal.me/victorgaydov
Last synced: 6 days ago

    Loading...
    Readme
    Loading...