title: How to fetch on barcode API barcode.monster
body: <p>I am using Quagga JS scanner and trying to fetch the barcode resulted from operation with the barcode.monster API.</p>
  <p>But i'm getting an error called &quot;opaque&quot; and have status 0.
  Any idea what is it?</p>
  <p>Website : <a href="https://barcode.monster/api/" rel="nofollow noreferrer">https://barcode.monster/api/</a></p>
  <pre><code>  Quagga.onDetected(function(data) {
  // //Once barcode detecterd, fetch from barcode.monster
    
  fetch('https://barcode.monster/api/' + data.codeResult.code, {
    mode: 'no-cors',
    headers: {
      'Content-Type': 'application/json',
    }})
  .then(response =&gt; console.log(response))
  .catch((error) =&gt; {
    console.error('Error:', error);
  });
  
  
    console.log(&quot;This is the scanner output: &quot; + data.codeResult.code);
    Quagga.stop();
    })
  </code></pre>
  <p>If i try <code>response.json()</code> I will get an error which says Unexpected end of input on the line where the json method is located.</p>
  <p>Also, if i try with text() method, I get a blank result.</p>
  <p>So far I was playing with the link and did not figure out. Studied some Fetch documentation, because I'm a beginner.</p>
  <pre><code>Response {type: &quot;opaque&quot;, url: &quot;&quot;, redirected: false, status: 0, ok: false, …}
  body: null
  bodyUsed: false
  headers: Headers {}
  ok: false
  redirected: false
  status: 0
  statusText: &quot;&quot;
  type: &quot;opaque&quot;
  url: &quot;&quot;
  </code></pre>
  <p>The above text is the response...</p>