Simple Go HTTP client with Black Magic

GitHub Repo stars GitHub Releases Mentioned in Awesome Go

Simple and Powerful

Simple and easy to use, providing rich client-level and request-level settings, all of which are intuitive and chainable methods

Easy Debugging

Provides powerful and convenient debug utilities, including debug logs, performance traces, and even dump the complete request and response content (See Debugging)

Easy API Testing

API testing can be done with minimal code, no need to explicitly create any Request or Client, or even to handle errors (See Quick HTTP Test)

Smart by Default

Detect and decode to utf-8 automatically if possible to avoid garbled characters (See Auto Decode), marshal request body and unmarshal response body automatically according to the Content-Type

Support Multiple HTTP Versions

Req support HTTP/1.1, HTTP/2, and HTTP/3, and can automatically detect the server side and select the optimal HTTP version for requests, you can also force the protocol if you want (See Force HTTP version)

Support Retry

Support automatic request retry and is fully customizable (See Retry)

Easy Download and Upload

You can download and upload files with simple request settings, and even set a callback to show real-time progress (See Download and Upload)

Exportable

req.Transport is exportable. Compared with http.Transport, it also supports HTTP3, dump content, middleware, etc. It can directly replace the Transport of http.Client in existing projects, and obtain more powerful functions with minimal code change

Extensible

Support Middleware for Request, Response, Client and Transport (See Request and Response Middleware and Client and Transport Middleware)