You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library contains a HTTP client, and a number of useful middlewares for
writing a HTTP client and server in Go. For more information and package
documentation, please see the godoc documentation.
Client
The Client struct makes it easy to interact with a JSON API.
Use the restclient.Transport as the http.Transport to easily inspect the raw
HTTP request and response. Set DEBUG_HTTP_TRAFFIC=true in your environment to
dump HTTP requests and responses to stderr.
Defining Custom Error Responses
rest exposes a number of HTTP error handlers - for example,
rest.ServerError(w, r, err) will write a 500 server error to w. By default,
these error handlers will write a generic JSON response over the wire, using
fields specified by the HTTP problem spec.
You can define a custom error handler if you like (say if you want to return
a HTML server error, or 404 error or similar) by calling RegisterHandler:
Donations free up time to make improvements to the library, and respond to
bug reports. You can send donations via Paypal's "Send Money" feature to
kev@inburke.com. Donations are not tax deductible in the USA.