title: Error: SyntaxError: Unexpected end of JSON input at fetch.then.response
body: <p>I get this error every time I try to use the POST method in my API.</p>
  
  <pre><code>SyntaxError: Unexpected end of JSON input at fetch.then.response 
  </code></pre>
  
  <p>When I use the GET method I get the data normally.
  This is the code:</p>
  
  <pre><code>const teste = () =&gt; {
  fetch("myURL/test", {
      method: "POST",
      headers: {
          "Content-Type": "application/json"
      },
      body: JSON.stringify({
          id: 1,
          name: "Teste",
          amount: 1,
          value: 3
      })
  })
  .then(response =&gt; response.json()) //Here is the error
  .then(data =&gt; {
      console.log(data);
  })
  .catch((err)=&gt;console.log(err))}
  </code></pre>
  
  <p>Can someone help me? Thank you.</p>
  
  <p>EDIT:
  I just add this line to see the log:</p>
  
  <pre><code>.then(response =&gt; console.log(response))
  </code></pre>
  
  <p>Here is what I got:</p>
  
  <pre><code>Response {
  type: "cors",
  url: "myURL/test",
  redirected: false,
  status: 201,
  ok: true,
  …}
  body: (...)
  bodyUsed: false
  headers: Headers {}
  ok: true
  redirected: false
  status: 201
  statusText: ""
  type: "cors"
  : "myURL/test"
  __proto__: Response
  </code></pre>