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

Top 5.2% on proxy.golang.org
Top 5.8% dependent packages on proxy.golang.org
Top 3.5% dependent repos on proxy.golang.org
Top 7.1% forks on proxy.golang.org

proxy.golang.org : github.com/emicklei/forest

Package forest has functions for REST Api testing in Go This package provides a few simple helper types and functions to create functional tests that call HTTP services. A test uses a forest Client which encapsulates a standard http.Client and a base url. Such a client can be created inside a function or by initializing a package variable for shared access. Using a client, you can send http requests and call multiple expectation functions on each response. Most functions of the forest package take the *testing.T variable as an argument to report any error. Example To compose http requests, you create a RequestConfig value which as a Builder interface for setting the path,query,header and body parameters. The ProcessTemplate function can be useful to create textual payloads. To inspect http responses, you use the Expect functions that perform the unmarshalling or use XMLPath or JSONPath functions directly on the response. If needed, implement the standard TestMain to do global setup and teardown. In contrast to the standard behavior, the Body of a http.Response is made re-readable. This means one can apply expectations to a response as well as dump the full contents. The function XMLPath provides XPath expression support. It uses the [https://godoc.org/launchpad.net/xmlpath] package. The similar function JSONPath can be used on JSON documents. Colorizes error output (can be configured using package vars). All functions can also be used in a setup and teardown as part of TestMain. (c) 2015, http://ernestmicklei.com. MIT License

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/emicklei/forest
License: MIT
Latest release: over 1 year ago
First release: over 7 years ago
Namespace: github.com/emicklei
Dependent packages: 1
Dependent repositories: 2
Stars: 123 on GitHub
Forks: 8 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 10 days ago

    Loading...
    Readme
    Loading...