By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
World of SoftwareWorld of SoftwareWorld of Software
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
Reading: No Need to Mock All the Time: A Better Way to Test API Resilience in Your Terminal | HackerNoon
Share
Sign In
Notification Show More
Font ResizerAa
World of SoftwareWorld of Software
Font ResizerAa
  • Software
  • Mobile
  • Computing
  • Gadget
  • Gaming
  • Videos
Search
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
World of Software > Computing > No Need to Mock All the Time: A Better Way to Test API Resilience in Your Terminal | HackerNoon
Computing

No Need to Mock All the Time: A Better Way to Test API Resilience in Your Terminal | HackerNoon

News Room
Last updated: 2025/12/04 at 6:36 PM
News Room Published 4 December 2025
Share
No Need to Mock All the Time: A Better Way to Test API Resilience in Your Terminal | HackerNoon
SHARE

“It works on my machine.”

We’ve all said it. But does your bash script work when the third-party API takes 15 seconds to respond? Does your backend service gracefully handle a sudden spike of 503 errors from a payment provider?

Writing a full mock server just to test a simple retry logic in a script is often overkill. In this tutorial, I’ll show you a faster way: Chaos Engineering directly in the terminal.

We will use curl and a cloud-based Chaos Proxy to inject failures into real network requests without changing a single line of your application code.

The Problem: Localhost is Too Perfect

When developing locally, network latency is near zero. APIs either work (200 OK) or they don’t (Connection Refused). But in production, you face:

High Latency: The server is busy. n Intermittent Failures: 5% of requests drop. n Throttling: You hit the rate limit.

Simulating this in a terminal usually involves complex iptables rules or local tools like tc (Traffic Control). There is an easier way.

The Solution: Cloud Chaos Proxy

Instead of configuring your OS, we will route specific requests through a proxy that “breaks” the traffic according to rules we define.

I’ll be using chaos-proxy.debuggo.app for this, but the concept applies to any programmable proxy.

Video Guide (1:27)

Prefer watching? Here is the 90-second workflow:

Step-by-Step Tutorial

1. Define the Failure

First, we need to tell the proxy what to break.

  • Target: httpbin.org (or your API domain).
  • Delay: 7 seconds (Simulate lag).
  • Failure Rate: 1 (100% of requests will fail).
  • Error Code: 503 Service Unavailable.

2. Trust the Certificate (The “One-Time” Setup)

Since we are intercepting HTTPS traffic, we need to trust the proxy’s CA certificate.

Download the mitmproxy-ca-cert.pem from the dashboard.

MacOS: Add it to Keychain Access -> System and set “Always Trust.”

Linux: Copy to /usr/local/share/ca-certificates/ and update.

3. The Magic Command

Now, we use curl with the -x(proxy) flag. n

curl -v -x http://user:[email protected]:13979 https://httpbin.org/get

Understanding the Output

When you run this command multiple times:

Scenario A (The Chaos): You’ll notice the terminal “hangs” for 7 seconds (our delay). Then:

< HTTP/1.1 500 Internal Server Error
< content-length: 56
< content-type: text/plain
...
Debuggo Chaos Injection: 500 Error

Scenario B (Success): The other 50% of the time, the request passes through to the real server: n

< HTTP/1.1 200 OK
...
{
  "args": {}, 
  "headers": { ... }
}

Real World Use Cases

  1. Testing CI Pipelines: Verify that your deployment scripts don’t crash if a dependency is slow.
  2. Cron Jobs: Ensure your nightly data sync retries correctly on failure.
  3. Quick Sanity Checks: Before pushing code, verify how the API client handles a 503 error.

Conclusion

You don’t need heavy infrastructure to test network resilience. A simple proxy setup allows you to inject chaos into any HTTP client—be it curl, wget, or your Python/Node.js scripts.

Happy Breaking! 🔨

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter Email Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article Intel abandons plans to sell its networking division Intel abandons plans to sell its networking division
Next Article Black Friday pricing lives on: Grab the Motorola Razr Ultra for Less! Black Friday pricing lives on: Grab the Motorola Razr Ultra for Less!
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow

Latest News

Avalanche Of Apple Departures Continues With Two More Executives – BGR
Avalanche Of Apple Departures Continues With Two More Executives – BGR
News
It’s Time to Save Silicon Valley From Itself
It’s Time to Save Silicon Valley From Itself
Gadget
iAero Protocol Launches Token Sweeper, Distributes 5% of LIQ Supply to Stakers | HackerNoon
iAero Protocol Launches Token Sweeper, Distributes 5% of LIQ Supply to Stakers | HackerNoon
Computing
Lumia Security raises M to bring governance and control to enterprise AI agents –  News
Lumia Security raises $18M to bring governance and control to enterprise AI agents – News
News

You Might also Like

iAero Protocol Launches Token Sweeper, Distributes 5% of LIQ Supply to Stakers | HackerNoon
Computing

iAero Protocol Launches Token Sweeper, Distributes 5% of LIQ Supply to Stakers | HackerNoon

4 Min Read
Viral rant on why ‘everyone in Seattle hates AI’ strikes a nerve, sparks debate over city’s tech vibe
Computing

Viral rant on why ‘everyone in Seattle hates AI’ strikes a nerve, sparks debate over city’s tech vibe

5 Min Read
SpyCloud Data Shows Corporate Users 3x More Likely to Be Targeted by Phishing Than By Malware | HackerNoon
Computing

SpyCloud Data Shows Corporate Users 3x More Likely to Be Targeted by Phishing Than By Malware | HackerNoon

6 Min Read
It’s Great That My AI Bot Argues With My Swagger Schema: Explaining Why | HackerNoon
Computing

It’s Great That My AI Bot Argues With My Swagger Schema: Explaining Why | HackerNoon

5 Min Read
//

World of Software is your one-stop website for the latest tech news and updates, follow us now to get the news that matters to you.

Quick Link

  • Privacy Policy
  • Terms of use
  • Advertise
  • Contact

Topics

  • Computing
  • Software
  • Press Release
  • Trending

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

World of SoftwareWorld of Software
Follow US
Copyright © All Rights Reserved. World of Software.
Welcome Back!

Sign in to your account

Lost your password?