<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Charles</title>
    <description>The latest articles on DEV Community by Charles (@xpdev99).</description>
    <link>https://dev.to/xpdev99</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4090391%2F36b8f46f-f98e-4c94-b712-f24e81d1c6a9.jpg</url>
      <title>DEV Community: Charles</title>
      <link>https://dev.to/xpdev99</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xpdev99"/>
    <language>en</language>
    <item>
      <title>How to test 500, 404, and 429 API responses in Chrome without touching the backend</title>
      <dc:creator>Charles</dc:creator>
      <pubDate>Sat, 29 Aug 2026 09:01:17 +0000</pubDate>
      <link>https://dev.to/xpdev99/how-to-test-500-404-and-429-api-responses-in-chrome-without-touching-the-backend-45m4</link>
      <guid>https://dev.to/xpdev99/how-to-test-500-404-and-429-api-responses-in-chrome-without-touching-the-backend-45m4</guid>
      <description>&lt;p&gt;A frontend screen is easiest to check on the happy path: the API returns &lt;code&gt;200&lt;/code&gt;, the JSON has the expected shape, and the UI looks fine.&lt;/p&gt;

&lt;p&gt;Then production returns something else.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;404&lt;/code&gt; because a resource was removed&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;429&lt;/code&gt; after the user hits a rate limit&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;500&lt;/code&gt; when an upstream service fails&lt;/li&gt;
&lt;li&gt;an empty array that nobody tested&lt;/li&gt;
&lt;li&gt;a response that takes five seconds instead of 200 ms&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reproducing each case through the backend can take coordination. Temporary branches in application code also need to be removed later. Browser-side response mocking offers another option for manual UI testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Chrome already provides
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://developer.chrome.com/docs/devtools/overrides" rel="noopener noreferrer"&gt;Chrome Local Overrides&lt;/a&gt; works well for replacing a response body or header, while &lt;a href="https://developer.chrome.com/docs/devtools/request-conditions" rel="noopener noreferrer"&gt;Request conditions&lt;/a&gt; can block or throttle matching URLs. Reusable &lt;code&gt;404&lt;/code&gt;, &lt;code&gt;429&lt;/code&gt;, &lt;code&gt;500&lt;/code&gt;, empty, and delayed responses are more convenient when they can be saved and switched without recreating each setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical test matrix
&lt;/h2&gt;

&lt;p&gt;For a user-details endpoint such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /api/users/42
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following cases form a useful manual test matrix.&lt;/p&gt;

&lt;h3&gt;
  
  
  404: the resource does not exist
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"User not found"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Things to check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does the page show a useful empty or not-found state?&lt;/li&gt;
&lt;li&gt;Does it avoid rendering stale user data?&lt;/li&gt;
&lt;li&gt;Can the user navigate somewhere useful?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  429: the client is rate limited
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Too many requests"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"retryAfter"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Things to check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does the UI stop sending the same request repeatedly?&lt;/li&gt;
&lt;li&gt;Is retry behavior clear?&lt;/li&gt;
&lt;li&gt;Does the page preserve the user's work?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  500: the server failed
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Internal server error"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Things to check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does the screen leave loading mode?&lt;/li&gt;
&lt;li&gt;Is retry available where it makes sense?&lt;/li&gt;
&lt;li&gt;Does an error in one panel break the whole page?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Add a delay to each response as a separate check. A UI that handles a fast error may still behave badly when the request stays pending for several seconds first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turning a real request into a reusable mock
&lt;/h2&gt;

&lt;p&gt;I built &lt;a href="https://chromewebstore.google.com/detail/mokup-mock-apis-in-devtoo/pemnjopjhbagogaojfgcfamailepnebb" rel="noopener noreferrer"&gt;Mokup&lt;/a&gt;, a DevTools extension that keeps these response scenarios inside Chrome instead of requiring a separate mock server or proxy.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2FsuSHZtuYumPyLAtsmdL1KP_xct5DxzXB3J3G6ocIdEoR_BgaeVq5DB5IlOBr6e9aAzVuXCZLSXcTJtguM5KNhc6B%3Dw1280-h800" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2FsuSHZtuYumPyLAtsmdL1KP_xct5DxzXB3J3G6ocIdEoR_BgaeVq5DB5IlOBr6e9aAzVuXCZLSXcTJtguM5KNhc6B%3Dw1280-h800" alt="Mokup capturing live API traffic inside Chrome DevTools" width="1280" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Mokup's Live tab captures the real request before turning it into a reusable mock rule.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The workflow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open DevTools and select the &lt;strong&gt;Mokup&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;Enable recording.&lt;/li&gt;
&lt;li&gt;Use the application normally so the real request appears in &lt;strong&gt;Live&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Create Mock&lt;/strong&gt; on that request.&lt;/li&gt;
&lt;li&gt;Change the status code, response body, or delay.&lt;/li&gt;
&lt;li&gt;Enable the rule and trigger the request again.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2FmIZ4vVs-_bugK33PX8GgXKHTiqq53tmfIOh0re1-jX6XA1ZphDwaJhFBQ7V5IP_LSc_Hl1xzqkIk0yGozc7tUKHRsw%3Dw1280-h800" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2FmIZ4vVs-_bugK33PX8GgXKHTiqq53tmfIOh0re1-jX6XA1ZphDwaJhFBQ7V5IP_LSc_Hl1xzqkIk0yGozc7tUKHRsw%3Dw1280-h800" alt="Editing a captured JSON response in Mokup" width="1280" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The captured response becomes an editable rule for the body, status code, and delay.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Because the rule starts from a captured request, the URL, method, and response shape do not need to be retyped from memory. Several cases can be saved and toggled while working on the screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2FEqFv0kbhNxQXMnBIwlEwOwwnIo8qtfcDYeaGC6i-_916sVK6bLAEPKs9JDPHASCZTQ2QIBaFtVVyabp138KO1m_vrw%3Dw1280-h800" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2FEqFv0kbhNxQXMnBIwlEwOwwnIo8qtfcDYeaGC6i-_916sVK6bLAEPKs9JDPHASCZTQ2QIBaFtVVyabp138KO1m_vrw%3Dw1280-h800" alt="Managing reusable API mock rules in Chrome DevTools" width="1280" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Saved rules stay in the Mokup panel, so scenarios can be switched without editing application code.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/O6DSaGU4gJQ" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Mokup stores its rules locally in Chrome. It does not require a separate mock server, a proxy process, or changes to application code.&lt;/p&gt;

&lt;h2&gt;
  
  
  When an extension is the wrong tool
&lt;/h2&gt;

&lt;p&gt;Mokup is meant for quick browser-side iteration. It is not a replacement for every mocking approach.&lt;/p&gt;

&lt;p&gt;Use Chrome Local Overrides when you need a simple body or header edit and the native workflow is enough.&lt;/p&gt;

&lt;p&gt;Use MSW or test-runner interception when the mock belongs in automated tests, should run in CI, or needs to be shared and reviewed with the codebase.&lt;/p&gt;

&lt;p&gt;Use a mock server when several clients need the same fake API or when the contract itself is the artifact your team is testing.&lt;/p&gt;

&lt;p&gt;Mokup currently intercepts browser Fetch/XHR traffic in the inspected page. It is not a full network proxy and is not the right tool for navigation requests, WebSockets, or binary-response workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  A small error-state checklist
&lt;/h2&gt;

&lt;p&gt;Before treating a screen as done, run its main request through four cases:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;normal response
empty response
slow response
error response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This check targets common failure modes: loading indicators that never stop, buttons that stay disabled, stale data after an error, and retry loops that make the failure worse.&lt;/p&gt;

&lt;p&gt;If Chrome's native tools cover the case, use them. If you keep rebuilding the same response scenarios, save them as rules instead.&lt;/p&gt;

&lt;p&gt;Disclosure: I built Mokup. The extension is available on the &lt;a href="https://chromewebstore.google.com/detail/mokup-mock-apis-in-devtoo/pemnjopjhbagogaojfgcfamailepnebb" rel="noopener noreferrer"&gt;Chrome Web Store&lt;/a&gt;, and the current free plan supports up to three mock rules.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>api</category>
      <category>testing</category>
      <category>devtools</category>
    </item>
    <item>
      <title>I Built a Chrome DevTools Extension to Mock APIs Without Leaving the Browser</title>
      <dc:creator>Charles</dc:creator>
      <pubDate>Sun, 23 Aug 2026 04:03:52 +0000</pubDate>
      <link>https://dev.to/xpdev99/i-built-a-chrome-devtools-extension-to-mock-apis-without-leaving-the-browser-1klf</link>
      <guid>https://dev.to/xpdev99/i-built-a-chrome-devtools-extension-to-mock-apis-without-leaving-the-browser-1klf</guid>
      <description>&lt;p&gt;Every frontend developer knows this pain: the backend isn't ready, it's down, or it returns data that doesn't match the design. You need to build UI against an API that doesn't exist yet.&lt;/p&gt;

&lt;p&gt;The usual workarounds all have friction:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Spin up a mock server&lt;/strong&gt; (json-server, mockoon) — another process, another port, another config to maintain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use a proxy tool&lt;/strong&gt; — powerful, but heavy setup for a quick "give me this response" moment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edit your code&lt;/strong&gt; — comment out the fetch, return hardcoded data, then remember to revert it before pushing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DevTools Request blocking&lt;/strong&gt; — blocks requests, but can't craft a response.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I built &lt;strong&gt;Mokup&lt;/strong&gt;: a Chrome DevTools panel that captures live API requests and turns them into editable mock rules. No proxy. No server. No code changes.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/O6DSaGU4gJQ"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install from the Chrome Web Store.&lt;/li&gt;
&lt;li&gt;Open DevTools → Mokup tab → enable &lt;strong&gt;Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Interact with your app — requests appear in the Live tab with method, URL, status, type, and timing.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Mock&lt;/strong&gt; on any request, edit the response body, toggle the rule on. Done — the next matching request returns your mock response.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Mocked requests are logged back to the Live tab so you can see what was intercepted, and you can enable/disable rules globally or per-rule.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why DevTools?
&lt;/h2&gt;

&lt;p&gt;Because that's where frontend developers already live. You don't open another tool, you don't change your workflow — the mock layer is right next to the network tab you're already looking at.&lt;/p&gt;

&lt;h2&gt;
  
  
  Details worth knowing
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Manifest V3, injected into the inspected tab &lt;strong&gt;only when the panel is open&lt;/strong&gt; (no background interception of your browsing).&lt;/li&gt;
&lt;li&gt;Mock rules and captured data stay &lt;strong&gt;local&lt;/strong&gt; — nothing is sent to any server.&lt;/li&gt;
&lt;li&gt;Free plan: up to 3 mock rules. Pro license (Polar license-key activation): unlimited rules.&lt;/li&gt;
&lt;li&gt;Honest limitation: this is a page-script interception layer for &lt;code&gt;fetch&lt;/code&gt; and XHR. It's not a full proxy — navigation requests, WebSockets, and binary responses aren't intercepted (yet).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Install: &lt;a href="https://chromewebstore.google.com/detail/mokup-mock-apis-in-devtoo/pemnjopjhbagogaojfgcfamailepnebb" rel="noopener noreferrer"&gt;https://chromewebstore.google.com/detail/mokup-mock-apis-in-devtoo/pemnjopjhbagogaojfgcfamailepnebb&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Demo video: &lt;a href="https://www.youtube.com/watch?v=O6DSaGU4gJQ" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=O6DSaGU4gJQ&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you try it, I'd love feedback — especially on the capture and mock-rule workflow. What's the biggest pain point in your current API mocking setup?&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>api</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
