Introduction
Req is a Simple Go HTTP client with Black Magic, write less code with more efficiency.
Features
- Simple and chainable methods for both client-level and request-level settings, and the request-level setting takes precedence if both are set.
- Powerful and convenient debug utilities, including debug logs, performance traces, and even dump the complete request and response content (see Debugging - Dump/Log/Trace).
- Easy making HTTP test with code instead of tools like curl or postman, req provide global wrapper methods and MustXXX to test API with minimal code (see Quick HTTP Test).
- Works fine with both HTTP/2 and HTTP/1.1, which HTTP/2 is preferred by default if server support, and you can also force http version if you want (see Force HTTP version).
- Detect the charset of response body and decode it to utf-8 automatically to avoid garbled characters by default (see Auto Decode).
- Automatic marshal and unmarshal for JSON and XML content type and fully customizable (see Marshal and Unmarshal).
- Exportable Transport, easy to integrate with existing http.Client, debug APIs with minimal code change.
- Easy Download and Upload.
- Easy set header, cookie, path parameter, query parameter, form data, basic auth, bearer token for both client and request level.
- Easy set timeout, proxy, certs, redirect policy, cookie jar, compression, keepalive etc for client.
- Support middleware before request sent and after got response (see Request and Response Middleware).
- Support http fingerprint impersonation, so that we can access websites that prohibit crawler programs by identifying http fingerprints (See HTTP Fingerprint).
- You can use HTTP Basic Auth, Bearer Auth Token and Digest Auth out of box (see Authentication).
License
Req
released under MIT license, refer LICENSE file.