gitwtfhub

wtf is ohhttpstubs?

lightricks/ohhttpstubs — explained in plain English

Analysis updated 2026-08-01 · repo last pushed 2024-03-03

Objective-CAudience · developerComplexity · 2/5DormantSetup · easy

TL;DR

A testing tool for iOS and Mac apps that intercepts network requests and returns fake responses, so tests run instantly without needing a real server or internet connection.

Mindmap

mindmap
  root((repo))
    What it does
      Intercepts network requests
      Returns fake responses
      Simulates slow networks
    Tech stack
      Objective-C
      Apple networking
    Use cases
      Test without internet
      Simulate server errors
      Automate app testing
    Audience
      iOS developers
      QA engineers
    Installation
      CocoaPods
      Swift Package Manager
      Carthage

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Feed fake data to an app during testing so it displays correctly without a live server.

REASON 2

Simulate server errors to verify the app shows the right error messages to users.

REASON 3

Test how the app behaves on slow or bad network connections.

REASON 4

Run automated test suites instantly and reliably without internet access.

What's in the stack?

Objective-CiOSmacOS

How it stacks up

lightricks/ohhttpstubsadispring/mapios8aonez/microsoftsurfacemacaudiofix
LanguageObjective-CObjective-CObjective-C
Last pushed2024-03-032014-12-112024-11-28
MaintenanceDormantDormantStale
Setup difficultyeasyeasymoderate
Complexity2/52/52/5
Audiencedeveloperdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Install via CocoaPods, Swift Package Manager, or Carthage, no external infrastructure required.

Wtf does this do

OHHTTPStubs is a tool that lets iOS and Mac app developers test their apps using fake network responses instead of real ones. Instead of waiting for a live server to return data, the developer can tell the app to use a saved file as the response. This means tests run instantly, reliably, and without needing an internet connection. The way it works is straightforward: the developer sets up a rule that says, "If my app tries to reach this specific website address, intercept that request and give it this fake response instead." The fake response can include a saved file, a custom status code (like a success or error code), and specific headers. The developer can also simulate slow or bad network conditions to see how the app handles them. It works with most popular networking tools used in Apple app development. This is mainly used by developers and QA engineers writing automated tests for their apps. For example, if a developer is building a weather app, they could use this tool to feed the app a fake weather forecast every time the test runs, ensuring the app displays the data correctly. They could also simulate a server error to verify the app shows the right error message to the user, all without actually breaking the real server. One notable thing about the tool is how it intercepts network traffic. It hooks into Apple's underlying networking system automatically, so it works with almost any networking library built on top of it. However, the README notes a few limitations: it cannot work with background downloads managed by the operating system, it doesn't simulate the process of uploading data, and it has some issues with redirects. The project also supports multiple ways to install it, including CocoaPods, Swift Package Manager, and Carthage.

Yoink these prompts

Prompt 1
Help me set up OHHTTPStubs in my iOS project using Swift Package Manager so I can intercept network requests in my tests.
Prompt 2
Write an OHHTTPStubs rule that intercepts requests to my weather API URL and returns a fake JSON response from a local file.
Prompt 3
Show me how to use OHHTTPStubs to simulate a 500 server error response with a 3-second delay so I can test my app's error handling.
Prompt 4
Help me stub a slow network response using OHHTTPStubs to test how my iOS app handles poor connectivity.

Frequently asked questions

wtf is ohhttpstubs?

A testing tool for iOS and Mac apps that intercepts network requests and returns fake responses, so tests run instantly without needing a real server or internet connection.

What language is ohhttpstubs written in?

Mainly Objective-C. The stack also includes Objective-C, iOS, macOS.

Is ohhttpstubs actively maintained?

Dormant — no commits in 2+ years (last push 2024-03-03).

How hard is ohhttpstubs to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is ohhttpstubs for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.