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

HTTP Request Mocking Libraries

Ranking updated Jun 30, 2026

For a mocking library for stubbing HTTP requests in tests, the strongest matches are netflix/pollyjs (Polly), nock/nock (nock is a pioneering Node) and mswjs/msw (MSW is a dedicated HTTP request mocking library that). pgte/nock and miragejs/miragejs round out the shortlist. Each is ranked by relevance to your query, popularity and recent activity.

Open-source tools for intercepting and stubbing network requests to facilitate reliable unit and integration testing.

HTTP Request Mocking Libraries

Find the best repos with AI.We'll search the best matching repositories with AI.
  • netflix/pollyjsNetflix avatar

    Netflix/pollyjs

    10,253View on GitHub↗

    Pollyjs is an HTTP mocking and recording library designed to capture and replay network interactions to create deterministic tests. It functions as a request interceptor and stubbing framework that records real API responses into files, ensuring consistent test results across different environments without relying on live network servers. The tool utilizes pluggable network adapters to support various environments and employs a state-based mode switching system to toggle between recording, replaying, and stubbing behaviors. It uses pattern-based request matching and persistent interaction sto

    Polly.js is an HTTP mocking library that intercepts requests, provides configurable responses via stubbing or replay from recordings, supports pattern-based request matching, integrates with test frameworks through adapters, and can pass through to real HTTP during recording mode—covering all the requested features for deterministic testing.

    JavaScriptHTTP Request InterceptorsRequest Interception Middleware
    View on GitHub↗10,253
  • nock/nocknock avatar

    nock/nock

    13,103View on GitHub↗

    nock is a Node.js HTTP mocking library and request interceptor. It captures outgoing network traffic to specific hosts and paths, returning predefined responses to decouple applications from external servers during automated testing. The project functions as an API expectation framework to verify that specific calls were made with correct parameters. It includes a traffic recorder that captures real network interactions as fixtures for playback and a network simulation tool to introduce artificial latency or trigger network errors. Its capabilities cover request matching via hostnames, paths

    nock is a pioneering Node.js HTTP mocking library that intercepts outgoing requests, returns configurable mock responses, supports request matching by host/path, and provides an expectation framework to assert which calls were made — it does everything this visitor needs for HTTP stub testing, missing only an explicit pass-through mode (which many real-world setups add via a separate setting).

    JavaScriptAPI Request MockingHTTP Request Interceptors
    View on GitHub↗13,103
  • mswjs/mswmswjs avatar

    mswjs/msw

    17,977View on GitHub↗

    MSW is a JavaScript API mocking library and integration testing tool designed to intercept network requests at the network level. It allows for the definition of mock data and status codes using routing syntax to simulate server responses without requiring changes to the application source code. The project utilizes a service worker to proxy API calls in the browser, providing a mechanism for isolated frontend development and testing. It employs platform-specific network adapters to maintain a consistent mocking interface across both browser and Node.js environments. The library covers a ran

    MSW is a dedicated HTTP request mocking library that intercepts network requests at the network level using service workers and Node.js adapters, fully supporting configurable mock responses, request matching, test framework integration, and fallback to real HTTP, making it an ideal solution for testing code that makes HTTP requests.

    TypeScriptAPI MockingRequest Interception Middleware
    View on GitHub↗17,977
  • pgte/nockpgte avatar

    pgte/nock

    13,108View on GitHub↗

    Nock is a Node.js HTTP mocking library used to intercept outgoing network requests and return predefined responses. It functions as a network request interceptor and HTTP mock server, allowing developers to simulate external API behavior for automated testing without making live network calls. The project includes an API fixture recorder to capture real network interactions and save them as reusable data files for playback. It also features a network latency simulator that introduces artificial delays to outgoing HTTP responses to verify timeout handling and race conditions. The library prov

    Nock is a Node.js library that intercepts outgoing HTTP requests and lets you define mock responses, with built-in request matching and assertion capabilities—exactly the kind of HTTP mocking tool this search is after.

    JavaScriptAPI Request Mocking
    View on GitHub↗13,108
  • miragejs/miragejsmiragejs avatar

    miragejs/miragejs

    5,527View on GitHub↗

    Mirage JS is a browser-based mock server and client-side API simulator designed for JavaScript application development. It functions as a mocking tool that intercepts network requests to simulate backend API behavior, allowing developers to build and test frontend interfaces without requiring live backend infrastructure. The tool provides a simulation layer that mimics REST endpoints to facilitate rapid prototyping of user flows and application logic. It enables the creation of fake server responses directly within the web browser to verify how an application handles various data scenarios an

    Mirage.js is a browser-based HTTP mocking library that intercepts network requests and returns configurable fake responses, directly matching your need to stub HTTP calls during testing; its primary focus on frontend API simulation covers interception, route matching, and test integration, though it may not include built-in pass-through to real servers or request assertion helpers.

    JavaScriptAPI MockingRequest Interception Middleware
    View on GitHub↗5,527
  • mock-server/mockserver-monorepoM

    mock-server/mockserver-monorepo

    4,897View on GitHub↗

    This project is a multi-protocol API simulation and mocking system designed to replace external dependencies during development and testing. It provides an API mocking server, a network traffic proxy, and specialized simulators for language model services and identity providers. The system distinguishes itself through deep AI simulation capabilities, including the emulation of language model providers and Model Context Protocol servers using JSON-RPC 2.0. It supports multi-turn conversational logic, state tracking for AI chat APIs, and the visualization of agent execution through call graphs

    MockServer intercepts HTTP requests via its proxy and server modes, offers configurable responses, request matching, pass-through proxying, and verification—so it covers all the requested features for test-time HTTP stubbing, though it is a full mocking system rather than a lightweight library.

    JavaRequest Matching RulesRegex Request MatchingRequest Body Matchers
    View on GitHub↗4,897
  • square/okhttpsquare avatar

    square/okhttp

    46,971View on GitHub↗

    OkHttp is an HTTP client for the JVM and Android that enables network communication via synchronous and asynchronous requests. It provides a core identity as a comprehensive networking toolkit featuring a WebSocket client for bidirectional data synchronization, a TLS security toolkit for encrypted communication, and a programmable HTTP mock server for simulating backend responses. The project distinguishes itself through a specialized security and performance architecture. It implements mutual TLS, certificate pinning, and DNS over HTTPS to secure data in transit, while utilizing connection p

    OkHttp is an HTTP client for the JVM and Android that includes a built‑in programmable mock server (MockWebServer) for intercepting requests, configuring responses, and asserting on received requests during tests, which aligns with the request‑mocking library intent but may lack native pass‑through to real HTTP for unmocked requests.

    KotlinHTTP Request Interceptors
    View on GitHub↗46,971
  • wheresrhys/fetch-mockwheresrhys avatar

    wheresrhys/fetch-mock

    1,310View on GitHub↗

    Fetch-mock is a testing utility designed to isolate application code from external network dependencies by intercepting and overriding outgoing traffic. It functions as a network request interceptor that captures calls made via the Fetch API, allowing developers to simulate server responses and verify application behavior without requiring a live backend infrastructure. The library distinguishes itself through a unified interface that provides consistent network interception logic across diverse runtime environments, including browsers, service workers, and server-side platforms. By replacing

    fetch-mock is a JavaScript library specifically built to intercept and stub fetch requests in tests, making it a perfect fit for your need to mock HTTP requests during testing.

    JavaScriptAPI Request Mocking
    View on GitHub↗1,310
  • ctimmerm/axios-mock-adapterctimmerm avatar

    ctimmerm/axios-mock-adapter

    3,544View on GitHub↗

    This library provides a utility for intercepting and simulating HTTP requests within the Axios ecosystem. It functions as an HTTP request interceptor that allows developers to define mock responses for outgoing network traffic, enabling frontend integration testing and development without requiring live backend infrastructure. The tool distinguishes itself by offering granular control over the request lifecycle, including the ability to match specific request patterns and forward unmatched traffic to actual destinations. It supports the simulation of unstable network environments by injecting

    axios-mock-adapter is a Node.js library that intercepts Axios HTTP requests in tests, allowing configurable mock responses and request matching — a straightforward fit if your codebase uses Axios.

    JavaScriptHTTP Request InterceptorsRequest Interception Middleware
    View on GitHub↗3,544
  • moya/moyaMoya avatar

    Moya/Moya

    15,364View on GitHub↗

    Moya is a network abstraction layer for Swift that provides a structured framework for defining and executing REST API requests. It functions as a type-safe API client that decouples network endpoint definitions from the underlying implementation details to prevent configuration errors and URL typos. The project distinguishes itself by using protocol-based endpoint definitions and a provider-coordinated execution model. It includes a system for mapping network responses to strongly typed objects and features a dedicated tool for generating type-safe network interface files from external REST

    Moya is a type-safe network abstraction layer for Swift that includes built-in support for stubbing API responses via sample data, but its primary identity is an API client framework rather than a dedicated HTTP request interception and stubbing library that works at the system networking level.

    SwiftAPI Request MockingAPI Mocking
    View on GitHub↗15,364
  • mockoon/mockoonmockoon avatar

    mockoon/mockoon

    8,080View on GitHub↗

    Mockoon is an HTTP API simulation platform and design tool used to create fake API endpoints that simulate server responses without a backend. It functions as an OpenAPI mock server tool and a JSON API mocking utility, allowing for the rapid iteration of API contracts and the generation of response templates. The project distinguishes itself through a combination of stateful mocking, using a local JSON database to simulate CRUD operations, and the ability to run as a headless API mock server via a command line interface. It supports real-time collaborative editing and AI-assisted prototyping

    Mockoon is a standalone HTTP mock server and desktop tool for simulating APIs, not a library that intercepts HTTP requests made by code during testing—you would send your test requests to its endpoints rather than letting it stub outgoing calls from within your code.

    TypeScriptMock-to-Real RoutingAPI MockingRequest Interception Middleware
    View on GitHub↗8,080
  • rack/rackrack avatar

    rack/rack

    5,124View on GitHub↗

    Rack is a minimal interface that standardizes how Ruby web servers and frameworks communicate. It provides a web application interface and a web server interface, enabling Ruby applications to run across different server implementations by using a common environment hash and a standardized response tuple. The project implements a modular HTTP middleware pipeline, allowing requests and responses to be intercepted and modified through a sequence of callable objects. It supports low-level connection management, including TCP connection hijacking for custom protocol handling, protocol upgrade sig

    Rack standardizes the interface between Ruby web servers and applications, providing middleware for request/response interception in production, but it is not a dedicated HTTP request mocking library for stubbing outbound requests in tests.

    RubyAPI Request MockingRequest Interception Middleware
    View on GitHub↗5,124
Compare the top 10 at a glance
RepositoryStarsLanguageLicenseLast push
netflix/pollyjs10.3KJavaScriptApache-2.0May 31, 2025
nock/nock13.1KJavaScriptMITJun 22, 2026
mswjs/msw18KTypeScriptMITMay 15, 2026
pgte/nock13.1KJavaScriptMITJun 26, 2026
miragejs/miragejs5.5KJavaScriptMITAug 11, 2025
mock-server/mockserver-monorepo4.9KJavaApache-2.0Jun 23, 2026
square/okhttp47KKotlinApache-2.0Jun 16, 2026
wheresrhys/fetch-mock1.3KJavaScriptMITJun 1, 2026
ctimmerm/axios-mock-adapter3.5KJavaScriptMITFeb 7, 2026
moya/moya15.4KSwiftMITFeb 28, 2026

Related searches

  • a mock server for prototyping APIs from a spec
  • a javascript library for making http requests
  • a testing assertions and mocking library for Go
  • an HTTP client library for Go
  • a java library for making http requests
  • a lightweight HTTP client for TypeScript
  • an http client library for Rust
  • a python library for making http requests