title: Making a POST request in Angular 2 with JSON body
body: <p>I am making some POST requests using POSTMAN as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/X47cy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X47cy.png" alt="enter image description here"></a></p>
  
  <p>This is using POSTMAN and it works just fine. Following is also from POSTMAN</p>
  
  <pre><code>POST /supervisor/stop/process HTTP/1.1
  Host: bento
  Content-Type: application/json
  Cache-Control: no-cache
  Postman-Token: 66b05631-8b4e-473a-9d3f-deaa544ecac6
  
  {
  "ip" : "192.168.1.115",
  "port" : "9001",
  "process" : "public_video_convert:video_convert_01"
  }
  </code></pre>
  
  <p>I tried the same thing using Angular 2 as follows:</p>
  
  <pre><code>let url = "http://bento/supervisor/stop/process";
          let data = {
              "ip": "192.168.1.115",
              "port": "9001",
              "process": "public_video_convert:video_convert_01"
          }
          let body = JSON.stringify(data);
          let head = new Headers({
              'Content-Type': 'application/json'
          });
  
          this.http.post(url, body, {headers : head})
              .map(res =&gt;  res.json())
              .subscribe(
                  data =&gt; {console.log(data);},
                  err =&gt; console.log(err),
                  () =&gt; console.log('Fetching complete for Server Metrics')
              );
  </code></pre>
  
  <p>When I run this, I get a <code>405 Method Not Allowed</code></p>
  
  <p>The details of the request and and the response from dev tools is as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/sQXg3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sQXg3.png" alt="enter image description here"></a></p>
  
  <p>I am not sure how to handle this.</p>