title: 500 Internal Server Error while making HTTP post request in typescript
body: <p>I am building an angular2 app and I am pretty new at angular2. I am trying to make a post request but as an answer from the server, I got <strong><em>500 INTERNAL SERVER ERROR</em></strong> and <strong><em>Response for preflight has invalid HTTP status code 500</em></strong>. However for the post request that I have made without the body, I don't get any error, and I was able to get the correct response from the server. </p>
  
  <p>Here are my service method and corresponding component.ts method.
  The code below shows the service.ts file.</p>
  
  <pre><code>SomeCoolMethod(input: HTMLInputElement) {
      let headers = new Headers({'Content-Type': 'application/json'});
      let options = new RequestOptions({headers: headers});
      let param = {'name': input.value};
      return this.http.post('fancyURL/SomeCoolMethod', param, options)
          .map(this.extractData);
  }
  
  private extractData(res: Response) {
      return res.json();
  }
  </code></pre>
  
  <hr>
  
  <p>The code below shows the component.ts file.</p>
  
  <pre><code>SomeCoolMethod(input: HTMLInputElement) {
      this.httpService.SomeCoolMethod(input).subscribe(response =&gt; {
          console.log(response)
      });
  }
  </code></pre>
  
  <p>I know that 500 Internal Server Error is because of the server. But when I make the same request to the server via Advanced Rest Client, it gave no such error. Is there anyone who knows the problem? I think I am setting parameters in an incorrect way but I couldn't find how to fix it. Can you help me with this one?</p>
  
  <p>Thanks in advance.</p>