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

github.com/andreyvit/httpsimplified/v2

Package httpsimp sends outgoing HTTP requests via a simple straightforward API distilled from many internal Golang projects at USA Today Network. It embraces Go stdlib types like url.Values and http.Header, provides composable building blocks for more complex use cases and doesn't try to be clever. Call Perform with MakeGet, MakeForm, MakeJSON or Make to send a request and parse the response: where httpsimp.JSON is a body parser function (we also provide PlainText, Bytes, Raw and None parsers, and you can define your own). See the example for more details. You need to pass an instance of *http.Client. You can use http.DefaultClient, but note that the default client has no timeouts and might potentially hang forever, causing goroutine leaks. A custom client is strongly recommended: You can adjust body parser parameters by passing additional options to body parser functions, like this: Available options: - httpsimp.StatusAny, httpsimp.Status4xx, httpsimp.Status4xx5xx, or a specific status like httpsimp.StatusOK or httpsimp.StatusSpec(http.StatusTeapot) will match only responses with the given status. - httpsimp.ContentType("application/something") will match only response with the given content type. - httpsimp.ContentType("") will match any content type (can be used to cancel default application/json filter used by JSON). - httpsimp.ReturnError() results in a non-nil error returned. Pass multiple parsers to handle alternative response types or non-2xx status codes: If you need a cancelable request, use http.Request.WithContext: You can build the entire http.Request yourself and just call Perform: When building custom requests, use our helpers: URL concatenates a URL and adds query params. EncodeForm, EncodeJSONBody and SetBody add a body to a request. Finally, you're free to obtain an http.Response through other means and then call Parse to handle the response: To handle HTTP basic authentication, use BasicAuthValue helper:

Ecosystem
proxy.golang.org
Latest Release
v2.0.2
about 6 years ago
Versions
5
Dependent Repos
1
Top 8.2% on proxy.golang.org
github.com/andreyvit/httpsimplified v1.1.0
Package httpsimplified sends outgoing HTTP requests via a simple straightforward API distilled fr...
2 versions - Latest release: over 7 years ago - 0 stars on GitHub
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/andreyvit/httpsimplified/v2
spec
License MIT
Namespace github.com/andreyvit/httpsimplified
First Release over 7 years ago
Last Synced 14 days ago
Repository
Stars 0 on GitHub
Forks 0 on GitHub
Rankings on proxy.golang.org
Dependent repos Top 4.8%