awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
unjs avatar

unjs/ofetch

0
View on GitHub↗
5,316 stars·170 forks·TypeScript·MIT·36 views

Ofetch

ofetch is an HTTP client built on the native fetch API that adds automatic JSON serialization, request/response interceptors, configurable retry, and timeout handling. It provides descriptive error objects for non-OK responses and automatically parses response bodies based on their content type.

The client supports creating pre-configured instances with preset base URLs, headers, and default options, enabling consistent configuration across a project. It offers full TypeScript type inference for response data and request payloads, and allows extending request options with custom properties while preserving type safety. Additional capabilities include hooking into the request lifecycle via async interceptors, routing requests through proxy servers using standard environment variables, and consuming Server-Sent Events streams in real time.

The library also provides flexible error handling with parsed response bodies, the ability to access raw Response objects, and support for request body serialization including binary data. ofetch is available as a TypeScript package and can be installed via common JavaScript package managers.

Features

  • Fetch API Wrappers - Wraps the native fetch API with additional features like interceptors, retry, and timeout.
  • JSON Request Serializers - Automatically stringifies object request bodies as JSON and sets the appropriate Content-Type header.
  • Automatic Body Deserializers - Automatically converts response data into JSON or Blob based on Content-Type header.
  • Response Body Parsing - Automatically parses HTTP response bodies as JSON, text, or binary based on content type.
  • HTTP Request Abstractions - Provides a feature-rich fetch wrapper that adds retries, timeouts, and automatic error handling.
  • HTTP Request Customization - Merges custom base URL, query parameters, headers, and timeout into every request.
  • Fetch-Based HTTP Clients - Ships a full-featured HTTP client built on the native fetch API with automatic JSON parsing, interceptors, retry, and timeout handling.
  • Client Instance Defaults - Creates reusable HTTP client instances with preset base URL, headers, and default options.
  • Retry Policies - Provides configurable retry of failed requests with custom status codes and delay between attempts.
  • API Request Configurations - Configures base URLs, default headers, and query parameters that apply to every request.
  • Pre-Configured HTTP Clients - Offers a factory function to create reusable HTTP clients with preset base URLs, headers, and default options.
  • API Request Configurations - Configures base URL, query parameters, and custom headers that apply to each request.
  • Descriptive HTTP Error Responses - Throws descriptive errors that include the parsed response body for non-OK HTTP responses.
  • HTTP Error Handling - Throws descriptive errors with parsed response body for non-OK statuses.
  • Descriptive HTTP Error Responses - Provides descriptive error objects containing the parsed response body for failed HTTP requests.
  • HTTP Request Interceptors - Provides async interceptors that hook into the request and response lifecycle for modification and logging.
  • Content-Type Based Deserializers - Automatically parses response bodies as JSON, blob, or text based on the Content-Type header.
  • Request Body Attachers - Automatically stringifies JSON request bodies and sets Content-Type headers, with binary support.
  • Request Lifecycle Hooks - Provides async hooks for logging, authentication, and dynamic modification during request lifecycle.
  • Request-Response Interceptors - Enables global interceptors to modify or log outgoing requests and incoming responses.
  • Request Retries - Automatically retries failed HTTP requests with configurable status codes, count, and delay.
  • Server Error Retries - Retries requests automatically on server error status codes with configurable delay and count.
  • Type-Safe Option Extensions - Adds custom properties to request configuration objects while preserving full type safety.
  • Request Abort Signals - Supports request timeout and custom cancellation signals to abort ongoing requests.
  • Response Type Inference - Infers response data types automatically so editors provide autocomplete for fields.
  • Request Timeouts - Aborts requests that exceed a specified time limit to prevent hanging connections.
  • Type-Safe API Clients - Provides full TypeScript type inference for response data and request payloads, ensuring type-safe client-server communication.

Star history

Star history chart for unjs/ofetchStar history chart for unjs/ofetch

How this analysis was created: This summary and feature list are AI-generated from collected project material and can contain mistakes. Stars, license and language are imported from GitHub. Inclusion does not mean that we have tested or audited this project. Check the source documentation for any feature you depend on. Learn more on our About page.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Projects sharing features with Ofetch

These projects share indexed features with Ofetch. Shared tags can include platform or build tooling; verify the primary use case before treating a result as a replacement.
  • sindresorhus/kysindresorhus avatar

    sindresorhus/ky

    16,943View on GitHub↗

    🌳 Tiny & elegant JavaScript HTTP client based on the Fetch API

    TypeScriptfetchhttp-clienthttp-request
    View on GitHub↗16,943
  • elbywan/wretchelbywan avatar

    elbywan/wretch

    5,174View on GitHub↗

    Wretch is a chainable HTTP client library and Fetch API wrapper designed to simplify network request configuration, response parsing, and error handling. It functions as a network request manager and middleware framework for managing the end-to-end lifecycle of HTTP calls. The project is distinguished by a fluent interface for request configuration and a modular extension system. It utilizes a programmable response resolver to automate parsing and a plugin-based architecture to add new capabilities to request and response objects. The library covers a broad range of operational capabilities,

    TypeScript
    View on GitHub↗5,174
  • forwardemail/superagentforwardemail avatar

    forwardemail/superagent

    16,649View on GitHub↗

    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 connection

    JavaScript
    View on GitHub↗16,649
  • mzabriskie/axiosmzabriskie avatar

    mzabriskie/axios

    109,096View on GitHub↗

    Axios is a promise-based HTTP client used to make asynchronous network requests in both browser and Node.js environments. It functions as a multi-environment network adapter that abstracts the transport layer to ensure consistent behavior across different runtimes. The project distinguishes itself through a request lifecycle management system that allows for the cancellation of active requests, the setting of timeouts, and the monitoring of upload and download transfer progress. It includes a mechanism for intercepting network traffic, enabling the transformation of outgoing requests and inco

    JavaScript
    View on GitHub↗109,096
Compare all 30 related projects→

Frequently asked questions

What does unjs/ofetch do?

ofetch is an HTTP client built on the native fetch API that adds automatic JSON serialization, request/response interceptors, configurable retry, and timeout handling. It provides descriptive error objects for non-OK responses and automatically parses response bodies based on their content type.

What are the main features of unjs/ofetch?

The main features of unjs/ofetch are: Fetch API Wrappers, JSON Request Serializers, Automatic Body Deserializers, Response Body Parsing, HTTP Request Abstractions, HTTP Request Customization, Fetch-Based HTTP Clients, Client Instance Defaults.

Which projects share features with unjs/ofetch?

Projects with overlapping indexed features include: sindresorhus/ky — 🌳 Tiny & elegant JavaScript HTTP client based on the Fetch API. elbywan/wretch — Wretch is a chainable HTTP client library and Fetch API wrapper designed to simplify network request configuration,… forwardemail/superagent — Superagent is an isomorphic JavaScript HTTP client for sending network requests and processing responses across both… mzabriskie/axios — Axios is a promise-based HTTP client used to make asynchronous network requests in both browser and Node.js… axios/axios — Axios is an isomorphic, promise-based HTTP client designed for making asynchronous network requests across different… sindresorhus/got — Got is a promise-based HTTP request library for Node.js that supports HTTP/2 and streaming. It provides a system for…