Angular2/Http (POST) headers
<p>I'm unable to change the headers when doing a POST request. I tried a couple of things:</p>

<p>Simple class:</p>

<pre><code>export class HttpService {
    constructor(http: Http) {
        this._http = http;
    }
}
</code></pre>

<p>I tried:</p>

<pre><code>testCall() {
    let body = JSON.stringify(
        { "username": "test", "password": "abc123" }
    )

    let headers = new Headers();
    headers.append('Content-Type', 'application/json'); // also tried other types to test if its working with other types, but no luck

    this._http.post('http://mybackend.local/api/auth', body, { 
        headers: headers 
    })
    .subscribe(
        data =&gt; { console.log(data); },
        err =&gt; { console.log(err); },
        {} =&gt; { console.log('complete'); }
    );
}
</code></pre>

<p>2:</p>

<pre><code>testCall() {
    let body = JSON.stringify(
        { "username": "test", "password": "abc123" }
    )

    let headers = new Headers();
    headers.append('Content-Type', 'application/json'); // also tried other types to test if its working with other types, but no luck

    let options = new RequestOptions({
        headers: headers
    });

    this._http.post('http://mybackend.local/api/auth', body, options)
    .subscribe(
        data =&gt; { console.log(data); },
        err =&gt; { console.log(err); },
        {} =&gt; { console.log('complete'); }
    );
}
</code></pre>

<p>none of the two are working. I didn't forget to import any of the classes. </p>

<p>I'm using Google Chrome. So I check the 'Network' tab, my request is there, and it says my Content-Type is text/plain. </p>

<p>Is this a bug or am I doing something wrong?</p>

<p><em>UPDATE</em>
I forgot to import the Headers class from Angular2/http:</p>

<pre><code>import {Headers} from 'angular2/http';
</code></pre>