title: Angular HttpClient make GET request with JSON in the body
body: <p>I am working on an Angular client application and a ASP.NET Core Web API backend, and I'm running into a problem trying to get a call to work from Angular that seems to work fine from Postman.</p>
  
  <p>Typescript code:</p>
  
  <pre><code> exportScript(commands: ScriptCommand[]) {
      this.http.post(this.baseUrl + 'api/ScriptCommands/GenerateScript', JSON.stringify(this.scriptCommands)).subscribe();
    }
  </code></pre>
  
  <p>C# API call:</p>
  
  <pre><code>    [HttpGet]
      [Route("api/ScriptCommands/GenerateScript")]
      public IActionResult GenerateScript([FromBody]List&lt;ScriptCommandViewModel&gt; commands)
      {
          var mappedCommands = MapCommands(commands);
          var stream = ProcessCommands(mappedCommands);
          return File(stream, "application/xml", "generatedScript.xml");
      }
  </code></pre>
  
  <p>When I use the Angular call, I get a 400 Bad Request back, but if I copy the JSON-stringified scriptCommand list into the body of a Postman request, it works just fine.</p>
  
  <p>Thanks for the help, everyone!</p>
  
  <p>UPDATE: Changed Typescript code - I still get an HTTP 400 Bad Request response, but my Network tab in Chrome shows this in the Request headers - is the content-type being 'text/plain' the issue?</p>
  
  <pre><code>Accept: application/json, text/plain, */*
  Content-Type: text/plain
  Origin: http://localhost:4200
  Referer: http://localhost:4200/createScript
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36
  </code></pre>