# imroc/req

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/imroc-req).**

4,807 stars · 402 forks · Go · MIT

## Links

- GitHub: https://github.com/imroc/req
- Homepage: https://req.cool
- awesome-repositories: https://awesome-repositories.com/repository/imroc-req.md

## Topics

`go` `golang` `http` `http-client`

## Description

req is a chainable HTTP client library for Go designed to simplify request configuration and automatic response decoding into structures. It provides a fluent-interface request builder that allows developers to incrementally define request properties and encapsulate HTTP logic into reusable API SDKs.

The project distinguishes itself with a TLS fingerprint emulator that mimics browser network signatures to bypass bot detection and crawler filters. It also includes a concurrent file downloader that increases transfer speeds by fetching large remote files in parallel segments.

The library covers a broad surface of network capabilities, including a pluggable middleware pipeline for centralized error handling and telemetry, stateful cookie management, and automatic proxy rotation. It supports various authentication schemes, detailed network performance measurement, and customizable request retry logic.

It also provides utilities for HTTP response mocking to facilitate unit testing without remote servers.

## Tags

### Networking & Communication

- [Fluent HTTP Request Configuration](https://awesome-repositories.com/f/networking-communication/fluent-http-request-configuration.md) — Implements a builder pattern allowing sequential method calls to configure HTTP request parameters fluently.
- [HTTP Client Libraries](https://awesome-repositories.com/f/networking-communication/http-client-libraries.md) — Implements a chainable Go library for configuring HTTP requests and automatically decoding responses into structures.
- [API Client SDK Builders](https://awesome-repositories.com/f/networking-communication/api-client-sdk-builders.md) — Provides utilities for encapsulating base URLs, shared headers, and authentication into reusable client implementations. ([source](https://req.cool/docs/examples/build-sdk-quickly-with-req/))
- [Concurrent File Downloaders](https://awesome-repositories.com/f/networking-communication/concurrent-file-downloaders.md) — Increases download speeds by splitting large files into segments and fetching them concurrently. ([source](https://req.cool/docs/tutorial/download/))
- [Application-Level Traffic Interception](https://awesome-repositories.com/f/networking-communication/application-level-traffic-interception.md) — Executes custom logic within the application request pipeline for tracing and cross-cutting concerns. ([source](https://req.cool/docs/tutorial/middleware-for-client-and-transport/))
- [Automated File Transfer Workflows](https://awesome-repositories.com/f/networking-communication/automated-file-transfer-workflows.md) — Implements robust upload and download workflows featuring parallel streaming and direct file system writing.
- [Client Default Settings](https://awesome-repositories.com/f/networking-communication/client-connection-defaults/client-default-settings.md) — Offers centralized configuration for base URLs and user agents applied across all client requests. ([source](https://req.cool/docs/prologue/quickstart/))
- [Multipart File Uploads](https://awesome-repositories.com/f/networking-communication/http-file-uploads/large-file-uploads/multipart-file-uploads.md) — Sends files and form data to servers using multipart encoding. ([source](https://req.cool/docs/tutorial/upload/))
- [HTTP Proxy Configuration](https://awesome-repositories.com/f/networking-communication/http-proxy-configuration.md) — Supports routing traffic through proxy servers to obscure the request origin. ([source](https://req.cool/docs/))
- [HTTP Request Debugging](https://awesome-repositories.com/f/networking-communication/http-request-debugging.md) — Captures raw requests and responses and traces network performance metrics for troubleshooting.
- [Transport Layer Interceptors](https://awesome-repositories.com/f/networking-communication/multi-round-trip-request-orchestration/transport-layer-interceptors.md) — Implements transport wrapping to intercept low-level network exchanges for debugging and telemetry.
- [Network Latency Measurements](https://awesome-repositories.com/f/networking-communication/network-latency-measurements.md) — Measures timing for DNS lookups, TCP connections, and TLS handshakes to identify network latency. ([source](https://req.cool/docs/tutorial/debugging/))
- [Network Traffic Analyzers](https://awesome-repositories.com/f/networking-communication/network-traffic-analyzers.md) — Captures, traces, and dumps raw request and response details to troubleshoot communication issues. ([source](https://cdn.jsdelivr.net/gh/imroc/req@master/README.md))
- [Proxy and Fingerprint Rotation](https://awesome-repositories.com/f/networking-communication/proxy-rotation-services/proxy-and-fingerprint-rotation.md) — Automatically rotates proxy servers to bypass rate limits and avoid IP blocking. ([source](https://req.cool/docs/examples/easily-write-crawlers-with-req/))
- [Download Progress Tracking](https://awesome-repositories.com/f/networking-communication/remote-file-downloads/download-progress-tracking.md) — Reports the progress of file downloads through a configurable callback function. ([source](https://req.cool/docs/tutorial/download/))
- [Request Header Configuration](https://awesome-repositories.com/f/networking-communication/request-header-configuration.md) — Includes comprehensive tools for defining and managing custom HTTP request headers and their ordering. ([source](https://req.cool/docs/tutorial/set-header/))
- [Upload Progress Tracking](https://awesome-repositories.com/f/networking-communication/upload-progress-tracking.md) — Monitors the percentage of data sent during file uploads via a callback function. ([source](https://req.cool/docs/tutorial/upload/))

### Web Development

- [HTTP Clients](https://awesome-repositories.com/f/web-development/http-clients.md) — A chainable HTTP client library for Go that simplifies request configuration and automatic response decoding.
- [Response Body Decoders](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/request-and-response-transformers/response-body-decoders.md) — Transforms HTTP response payloads into type-safe objects using configurable decoding strategies based on status codes. ([source](https://req.cool/docs/prologue/quickstart/))
- [Middleware Pipelines](https://awesome-repositories.com/f/web-development/middleware-pipelines.md) — Allows injection of custom logic into request, response, client, and transport pipelines via middleware. ([source](https://cdn.jsdelivr.net/gh/imroc/req@master/README.md))
- [Content-Type Based Deserializers](https://awesome-repositories.com/f/web-development/request-body-deserializers/request-and-response-transformers/content-type-based-deserializers.md) — Detects the Content-Type header to automatically determine the appropriate request and response parsing strategy.
- [Request Body Attachers](https://awesome-repositories.com/f/web-development/request-body-handling/request-body-alterations/request-body-attachers.md) — Enables attaching raw strings, form-encoded parameters, or JSON data as the body of an HTTP request. ([source](https://req.cool/docs/ref/request/))
- [HTTP Middleware Pipelines](https://awesome-repositories.com/f/web-development/request-middleware-pipelines/http-middleware-pipelines.md) — Provides a pluggable middleware pipeline for intercepting and transforming HTTP requests and responses.
- [Scraping Infrastructure Management](https://awesome-repositories.com/f/web-development/web-automation-scraping/web-scraping-automation/scraping-infrastructure-management.md) — Bypasses bot detection using TLS fingerprint emulation and automatic proxy rotation.
- [Direct-to-File Response Saving](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-utilities/http-response-builders/streaming-file-responses/direct-to-file-response-saving.md) — Writes response bodies directly to files to avoid loading large payloads into memory. ([source](https://req.cool/docs/tutorial/download/))
- [Cookie Management](https://awesome-repositories.com/f/web-development/cookie-management.md) — Automatically stores cookies from server responses and attaches them to subsequent requests. ([source](https://req.cool/docs/tutorial/cookie/))
- [Retry and Backoff Logic](https://awesome-repositories.com/f/web-development/http-client-wrappers/retry-and-backoff-logic.md) — Implements automated retry strategies and exponential backoff to handle network instability.
- [Query Parameter Manipulators](https://awesome-repositories.com/f/web-development/query-string-construction/query-parameter-manipulators.md) — Offers utilities for adding, removing, or replacing query string values using maps or structs. ([source](https://req.cool/docs/tutorial/set-query-param/))

### Data & Databases

- [HTTP Body Serialization](https://awesome-repositories.com/f/data-databases/data-type-managers/dynamic-type-managers/custom-type-serializers/data-type-serialization/http-body-serialization.md) — Automatically converts structured data to appropriate formats like JSON or XML for network transmission.

### Development Tools & Productivity

- [Request-Response Middleware](https://awesome-repositories.com/f/development-tools-productivity/execution-middleware/request-response-middleware.md) — Processes HTTP requests and responses through a sequence of pluggable handlers for centralized management.
- [REST API Integrations](https://awesome-repositories.com/f/development-tools-productivity/rest-api-integrations.md) — Simplifies connection to external REST services through automated data serialization and error mapping.
- [Path Parameter Definitions](https://awesome-repositories.com/f/development-tools-productivity/path-parameter-definitions.md) — Enables the definition of dynamic segments within a URL path to create reusable API request templates. ([source](https://req.cool/docs/tutorial/set-path-param/))
- [Request Parameter Configuration](https://awesome-repositories.com/f/development-tools-productivity/request-parameter-configuration.md) — Provides tools for defining dynamic query and path parameters for outgoing network requests. ([source](https://req.cool/docs/ref/request/))

### Security & Cryptography

- [TLS Fingerprint Emulators](https://awesome-repositories.com/f/security-cryptography/device-fingerprinting/fingerprint-configuration/tls-fingerprinting/tls-fingerprint-emulators.md) — Replicates exact TLS handshake parameters and cipher suites of target browsers to evade bot detection.
- [TLS Handshake Orchestrators](https://awesome-repositories.com/f/security-cryptography/governance-policy-frameworks/security-infrastructure/tls-handshake-orchestrators.md) — Dynamically manages TLS handshake parameters using custom certificates and browser fingerprints. ([source](https://req.cool/docs/ref/client/))

### Software Engineering & Architecture

- [Fluent Request Builders](https://awesome-repositories.com/f/software-engineering-architecture/fluent-request-builders.md) — Uses an API pattern with method chaining to accumulate request configuration state before execution.
- [Structured Error Responses](https://awesome-repositories.com/f/software-engineering-architecture/api-error-handling-patterns/structured-error-responses.md) — Converts error response bodies into structured objects when the server returns failure status codes. ([source](https://req.cool/docs/examples/integrate-opentelemetry-and-jaeger/))
- [Cookie Management](https://awesome-repositories.com/f/software-engineering-architecture/architectural-design-patterns/state-management/persistence-and-serialization/cookie-management.md) — Automates the storage and transmission of session cookies across multiple network requests.
- [Error Handling Middleware](https://awesome-repositories.com/f/software-engineering-architecture/error-handling-middleware.md) — Uses middleware to uniformly process API errors and network failures across all requests. ([source](https://req.cool/docs/examples/handle-exceptions-with-middleware/))
- [HTTP Status-to-Logic Mappings](https://awesome-repositories.com/f/software-engineering-architecture/error-handling/error-management/application-error-handlers/http-status-mapping/http-status-to-logic-mappings.md) — Maps non-success HTTP status codes to specific error objects using unified client-level logic. ([source](https://cdn.jsdelivr.net/gh/imroc/req@master/README.md))
- [Error Type Transformations](https://awesome-repositories.com/f/software-engineering-architecture/error-handling/error-management/error-type-compositions/error-type-transformations.md) — Converts consistent API error formats from server responses into uniform internal error types. ([source](https://req.cool/docs/tutorial/best-practices/))

### DevOps & Infrastructure

- [Automatic Retry Clients](https://awesome-repositories.com/f/devops-infrastructure/api-service-management/api-resilience/request-retries/automatic-retry-clients.md) — Automatically retries failed network calls using customizable backoff strategies and policies. ([source](https://cdn.jsdelivr.net/gh/imroc/req@master/README.md))
- [Response Body Streaming](https://awesome-repositories.com/f/devops-infrastructure/file-uploaders/large-file-optimization/response-body-streaming.md) — Directs response bodies into custom writers for immediate, fragment-based processing. ([source](https://req.cool/docs/tutorial/download/))
