title: Fetch -API returning HTML instead of JSON
body: <p>I have a Spring REST API which I've tested on Postman and it returns perfectly valid JSON.
  However when I call the same API on my front-end React Code it returns HTML.
  This is the function, I'm using to call the API,</p>
  
  <pre><code>export function run(engine, mediaId, owner, target, access){
    let url = engine + "/" + mediaId + "?id=" + owner + "&amp;targetId=" + target + "&amp;access=" + access;
  
    return fetch(full_url, { credentials: "include",
                             headers: {
                               "Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
                            }})
      .then((response) =&gt; {
  
        return response.json();})
      .then((data) =&gt; {
          console.log(data);
  
      })
      .catch((error) =&gt; {
          console.log(error);
      });
  }
  </code></pre>
  
  <p>I get a syntax error on this call <code>Unexpected token &lt; Thus when I check using response.text()</code> I can see that the data returned is HTML and not JSON. What do I need to change in my front-end code for the API to return JSON.</p>