<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/http-fake-sequences-for-testing-flaky-third-party-apis-os09yxwsl" -->

---
title: Http::fake() Sequences for Testing Flaky Third-Party APIs
description: Explains how to use Laravel&#x27;s Http::fake() response sequences to simulate flaky third-party APIs when testing retry logic, circuit breakers, and fallback...
canonical: https://daily.dev/posts/http-fake-sequences-for-testing-flaky-third-party-apis-os09yxwsl
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Http::fake() Sequences for Testing Flaky Third-Party APIs | daily.dev
og:description: Explains how to use Laravel&#x27;s Http::fake() response sequences to simulate flaky third-party APIs when testing retry logic, circuit breakers, and fallback...
og:url: https://daily.dev/posts/http-fake-sequences-for-testing-flaky-third-party-apis-os09yxwsl
og:image: https://api.daily.dev/og/posts/oS09YxWSl.png
og:image:alt: Http::fake() Sequences for Testing Flaky Third-Party APIs
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Http::fake() Sequences for Testing Flaky Third-Party APIs

**[PHP Architect](https://daily.dev/sources/phparchitect)** · [@shocm](https://daily.dev/shocm) · 1 min read · 0 upvotes · 0 comments

## Summary

Explains how to use Laravel's Http::fake() response sequences to simulate flaky third-party APIs when testing retry logic, circuit breakers, and fallback behavior, going beyond simple happy-path mocking of a single successful response.

## Content

Most Http::fake() examples stop at the happy path: fake one successful JSON response, assert the code handles it. That's fine until you're testing retry logic, circuit breakers, or fallback behavior — code whose entire purpose is reacting to a sequence of different responses, not one. Http::fake() supports exactly that through response sequences.

https://laravelmagazine.com/http-fake-sequences-for-testing-flaky-third-party-apis

## Similar posts on daily.dev

- [Creating custom Facade fakes in Laravel](https://daily.dev/posts/creating-custom-facade-fakes-in-laravel-dkgh09wlv) · FREEK.DEV · 2 upvotes · 0 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#php](https://daily.dev/tags/php), [#laravel](https://daily.dev/tags/laravel)

[View this post on daily.dev](https://daily.dev/posts/http-fake-sequences-for-testing-flaky-third-party-apis-os09yxwsl)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/http-fake-sequences-for-testing-flaky-third-party-apis-os09yxwsl","headline":"Http::fake() Sequences for Testing Flaky Third-Party APIs","text":"Explains how to use Laravel's Http::fake() response sequences to simulate flaky third-party APIs when testing retry logic, circuit breakers, and fallback behavior, going beyond simple happy-path mocking of a single successful response.","url":"https://daily.dev/posts/http-fake-sequences-for-testing-flaky-third-party-apis-os09yxwsl","datePublished":"2026-08-30T22:01:48.230Z","dateModified":"2026-08-30T22:02:04.374Z","author":{"@type":"Person","name":"Eric Johnson","url":"https://daily.dev/shocm","image":"https://media.daily.dev/image/upload/s--EPMJ-a-K--/f_auto/v1755890250/avatars/avatar_y7ct3dSEp45NFSALYHve6?_a=BAMClqZW0","description":"PHP Architect team member. I am powered by 16-year-old single malt Scotch and baseball.","worksFor":{"@type":"Organization","name":"php[architect]","logo":"https://res.cloudinary.com/daily-now/image/upload/s--10MwB_VH--/f_auto/v1726147436/companies/phparch"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":320}},"image":"https://media.daily.dev/image/upload/s--QIFxU_aq--/f_auto/v1788127308/posts/oS09YxWSl?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/phparchitect","name":"PHP Architect"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"PHP Architect","item":"https://daily.dev/squads/phparchitect"},{"@type":"ListItem","position":3,"name":"Http::fake() Sequences for Testing Flaky Third-Party APIs"}]}
```

