<?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: Poonam Biradar</title>
    <description>The latest articles on DEV Community by Poonam Biradar (@poonambuilds).</description>
    <link>https://dev.to/poonambuilds</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%2F4200078%2F725b51a9-2280-456f-8bba-04530d90ad66.jpg</url>
      <title>DEV Community: Poonam Biradar</title>
      <link>https://dev.to/poonambuilds</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/poonambuilds"/>
    <language>en</language>
    <item>
      <title>Works in Postman, Fails in the Browser: Where to Start Debugging</title>
      <dc:creator>Poonam Biradar</dc:creator>
      <pubDate>Thu, 22 Oct 2026 09:36:41 +0000</pubDate>
      <link>https://dev.to/poonambuilds/works-in-postman-fails-in-the-browser-where-to-start-debugging-24cf</link>
      <guid>https://dev.to/poonambuilds/works-in-postman-fails-in-the-browser-where-to-start-debugging-24cf</guid>
      <description>&lt;p&gt;An API returns &lt;code&gt;200 OK&lt;/code&gt; in Postman, but the frontend can’t load the data.&lt;/p&gt;

&lt;p&gt;Where do you start?&lt;/p&gt;

&lt;p&gt;CORS is one possibility. But before changing server settings, check whether your frontend is sending the same request you tested in Postman.&lt;/p&gt;

&lt;p&gt;Here are three checks that help narrow it down.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Compare what you actually sent
&lt;/h2&gt;

&lt;p&gt;Consider this example.&lt;/p&gt;

&lt;p&gt;In Postman, you configure bearer authentication and successfully request a list of orders:&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 https://api.example.com/api/orders
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you write this in your frontend:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.example.com/api/orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same endpoint. Different request.&lt;/p&gt;

&lt;p&gt;The frontend isn’t sending the authorization header. Postman’s saved token doesn’t carry over to your application.&lt;/p&gt;

&lt;p&gt;For an API that requires bearer authentication, the request could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getOrders&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.example.com/api/orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;Accept&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Bearer &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Request failed: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The URL above is a placeholder. Use your endpoint and a valid user access token from your authentication flow.&lt;/p&gt;

&lt;p&gt;Also compare the method, query parameters, and request body. If the token is present, check whether it has expired.&lt;/p&gt;

&lt;p&gt;Notice the &lt;code&gt;response.ok&lt;/code&gt; check: &lt;code&gt;fetch()&lt;/code&gt; doesn’t automatically throw when the server returns an HTTP error such as &lt;code&gt;401&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Read the browser’s request
&lt;/h2&gt;

&lt;p&gt;Instead of relying only on an error message in the UI, open:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Developer Tools → Network&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Trigger the request again and select it.&lt;/p&gt;

&lt;p&gt;Start with four questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is this the URL I expected?&lt;/li&gt;
&lt;li&gt;Did the authorization header get sent?&lt;/li&gt;
&lt;li&gt;What status came back?&lt;/li&gt;
&lt;li&gt;What does the response body say?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, a readable &lt;code&gt;401&lt;/code&gt; response gives you a reason to investigate authentication. An HTML response where you expected JSON might be a login page or an error page.&lt;/p&gt;

&lt;p&gt;Check the Console too. If it reports a CORS error, move to the next check.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Check whether the browser can read the response
&lt;/h2&gt;

&lt;p&gt;Suppose your application uses these addresses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Frontend: http://localhost:3000
API:      http://localhost:8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They have different ports, so they are different origins.&lt;/p&gt;

&lt;p&gt;For browser-side JavaScript to read that API response, the server needs to allow the frontend’s origin through CORS.&lt;/p&gt;

&lt;p&gt;Postman’s desktop client doesn’t enforce the browser’s same-origin restrictions. A successful request there doesn’t confirm that browser access is configured.&lt;/p&gt;

&lt;p&gt;For this local setup, the server might return:&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;Access-Control-Allow-Origin: http://localhost:3000
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a &lt;strong&gt;response header set by the server&lt;/strong&gt;. Adding it to your frontend request won’t grant permission.&lt;/p&gt;

&lt;p&gt;And a CORS error doesn’t always mean the API received nothing. The server may have responded while the browser prevented your JavaScript from reading the response.&lt;/p&gt;

&lt;h3&gt;
  
  
  What about the OPTIONS request?
&lt;/h3&gt;

&lt;p&gt;A cross-origin request containing an &lt;code&gt;Authorization&lt;/code&gt; header generally triggers a preflight.&lt;/p&gt;

&lt;p&gt;You’ll see an &lt;code&gt;OPTIONS&lt;/code&gt; request in the Network tab before the intended request. The browser uses it to check whether the method and headers are allowed.&lt;/p&gt;

&lt;p&gt;If that check fails, the intended request won’t be sent.&lt;/p&gt;

&lt;p&gt;Check your server’s CORS settings and whether middleware or a proxy is rejecting &lt;code&gt;OPTIONS&lt;/code&gt;. The actual response needs the appropriate CORS headers too.&lt;/p&gt;

&lt;p&gt;Avoid treating this as a fix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;no-cors&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a normal JSON API integration, it leaves you with a response your JavaScript cannot read normally.&lt;/p&gt;

&lt;h2&gt;
  
  
  One distinction if you use Next.js
&lt;/h2&gt;

&lt;p&gt;These browser restrictions apply when the request runs in the browser.&lt;/p&gt;

&lt;p&gt;A request from a Next.js server route runs on the server, where browser CORS enforcement doesn’t apply. Authentication, network access, and the API’s own restrictions still matter.&lt;/p&gt;

&lt;p&gt;So check &lt;strong&gt;where the request executes&lt;/strong&gt;, not just which framework you’re using.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where I’d start
&lt;/h2&gt;

&lt;p&gt;Before changing the backend, compare the working Postman request with the request shown in the browser’s Network tab.&lt;/p&gt;

&lt;p&gt;That comparison helps separate three different problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The frontend sent something different.&lt;/li&gt;
&lt;li&gt;The API rejected the request.&lt;/li&gt;
&lt;li&gt;The browser wouldn’t let JavaScript read the response.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each needs a different fix.&lt;/p&gt;

&lt;p&gt;If you’ve run into this mismatch, what turned out to be different?&lt;/p&gt;




&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS" rel="noopener noreferrer"&gt;MDN: Cross-Origin Resource Sharing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch" rel="noopener noreferrer"&gt;MDN: Using the Fetch API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

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