# forwardemail/superagent

**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/forwardemail-superagent).**

16,649 stars · 1,320 forks · JavaScript · MIT

## Links

- GitHub: https://github.com/forwardemail/superagent
- Homepage: https://forwardemail.github.io/superagent/
- awesome-repositories: https://awesome-repositories.com/repository/forwardemail-superagent.md

## Description

Superagent is an isomorphic JavaScript HTTP client for sending network requests and processing responses across both Node.js and web browser environments. It provides a fluent request builder that uses a chainable interface to construct complex network requests with custom headers, query strings, and bodies.

The library functions as a runtime-agnostic request adapter, allowing a single codebase to work consistently across different environments. It includes specialized capabilities such as an HTTP/2 client for forcing the HTTP/2 protocol and a Node.js agent for managing Unix socket connections and TLS settings.

Its capability surface covers API integration and data consumption, including multipart file uploads, automatic response deserialization, and stream-based data piping. It also provides security and session management through persistent cookie state, request authentication, and TLS connection configuration.

The system is extensible via a client plugin system and plugin-based lifecycle hooks that allow for custom behavior during the request cycle.

## Tags

### Software Engineering & Architecture

- [Fluent Interfaces](https://awesome-repositories.com/f/software-engineering-architecture/fluent-interfaces.md) — Implements a fluent interface for constructing and sending network requests through chainable method calls. ([source](https://github.com/forwardemail/superagent/blob/master/.zuul.yml))
- [Lifecycle Plugin Systems](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/plugin-module-systems/extensible-server-architectures/lifecycle-plugin-systems.md) — Implements a plugin architecture with lifecycle hooks to extend request behavior for caching, throttling, and signing. ([source](https://github.com/forwardemail/superagent#readme))

### Web Development

- [HTTP Request Clients](https://awesome-repositories.com/f/web-development/http-request-clients.md) — Provides a comprehensive tool for executing standard HTTP methods to interact with remote servers and APIs.
- [HTTP Error Handling](https://awesome-repositories.com/f/web-development/http-error-handling.md) — Provides capabilities to interpret specific HTTP status codes as errors and define custom success criteria. ([source](https://forwardemail.github.io/superagent/))
- [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 of incoming responses to automatically parse bodies into appropriate formats.
- [Request Body Handling](https://awesome-repositories.com/f/web-development/request-body-handling.md) — Automatically serializes data as JSON, URL-encoded forms, or FormData for transmission. ([source](https://forwardemail.github.io/superagent/))
- [Multipart Upload Utilities](https://awesome-repositories.com/f/web-development/multipart-upload-utilities.md) — Constructs complex multipart requests containing both file attachments and text fields for data uploads. ([source](https://forwardemail.github.io/superagent/))
- [Request Lifecycle Hooks](https://awesome-repositories.com/f/web-development/request-lifecycle-hooks.md) — Extends request behavior by executing a sequence of plugin-based middleware functions during the request cycle.

### Part of an Awesome List

- [Data Fetching and API](https://awesome-repositories.com/f/awesome-lists/devtools/data-fetching-and-api.md) — Facilitates fetching and parsing JSON or binary data from external APIs for use in applications.

### DevOps & Infrastructure

- [Automatic Body Deserializers](https://awesome-repositories.com/f/devops-infrastructure/response-parsing-utilities/automatic-body-deserializers.md) — Automatically converts response data from formats like JSON or URL-encoded forms into usable objects. ([source](https://forwardemail.github.io/superagent/))
- [Runtime Adapters](https://awesome-repositories.com/f/devops-infrastructure/runtime-agnostic-deployment-tools/runtime-adapters.md) — Provides a runtime adapter layer that enables the same request code to work across both browser and Node.js environments.
- [Request Retries](https://awesome-repositories.com/f/devops-infrastructure/api-service-management/api-resilience/request-retries.md) — Automatically re-attempts failed network requests based on specific criteria to handle transient failures. ([source](https://forwardemail.github.io/superagent/))

### Networking & Communication

- [HTTP Request Builders](https://awesome-repositories.com/f/networking-communication/http-request-builders.md) — Utilizes a builder pattern to construct HTTP requests using a chain of method calls.
- [Isomorphic HTTP Clients](https://awesome-repositories.com/f/networking-communication/isomorphic-http-clients.md) — Maintains a single, consistent API for making asynchronous requests across both browser and Node.js runtimes.
- [Request Header Configuration](https://awesome-repositories.com/f/networking-communication/request-header-configuration.md) — Allows assignment of specific field names and values to HTTP headers to control request metadata. ([source](https://github.com/forwardemail/superagent/blob/master/index.html))
- [HTTP/2 Protocol Implementations](https://awesome-repositories.com/f/networking-communication/http-2-protocol-implementations.md) — Includes a specialized client capable of forcing the HTTP/2 protocol for high-performance communication.
- [HTTP/2 Support](https://awesome-repositories.com/f/networking-communication/http-2-support.md) — Supports initiating network requests using the HTTP/2 protocol with the ability to prevent protocol fallback. ([source](https://github.com/forwardemail/superagent/blob/master/index.html))
- [HTTP Request Piping](https://awesome-repositories.com/f/networking-communication/http-request-piping.md) — Enables streaming data directly from a source into a request or piping a response body to a destination. ([source](https://forwardemail.github.io/superagent/))
- [Node.js HTTP Agents](https://awesome-repositories.com/f/networking-communication/node-js-http-agents.md) — Ships a Node.js agent for managing TLS settings, Unix socket connections, and persistent session cookies.
- [Specialized Network Transports](https://awesome-repositories.com/f/networking-communication/specialized-network-transports.md) — Enables specialized communication via Unix domain sockets and enforced HTTP/2 protocol usage.

### Development Tools & Productivity

- [HTTP Stream Piping](https://awesome-repositories.com/f/development-tools-productivity/stream-piping-utilities/http-stream-piping.md) — Supports piping readable and writable streams directly to request and response bodies for efficient handling of large payloads.

### Security & Cryptography

- [HTTP Authentication Schemes](https://awesome-repositories.com/f/security-cryptography/http-authentication-schemes.md) — Supports applying basic and bearer token authentication to outgoing requests using native browser and Node.js methods. ([source](https://forwardemail.github.io/superagent/))
- [Secure Connection Handlers](https://awesome-repositories.com/f/security-cryptography/secure-connection-handlers.md) — Manages secure connections by specifying TLS certificates, keys, and validation settings. ([source](https://forwardemail.github.io/superagent/))
- [Session & Cookie Handlers](https://awesome-repositories.com/f/security-cryptography/session-cookie-handlers.md) — Maintains a persistent cookie jar to simulate browser-like sessions in non-browser environments.
