Angular 2 And Controlling HTTP Request and Response
<p>In Angular 2 I am trying to control http request/response to set/read some headers when sending request and getting response.</p>

<p>I just override HttpRequest like this, and it is working for me :</p>

<pre><code>@Injectable()
export class HttpRequest extends RequestOptions {
    constructor() {
         super({
             method: RequestMethod.Get,
             headers: new Headers({
                'X-Some-Header': 'some-content'})
        });
    }
}
</code></pre>

<p>But for overriding Response I have problem :</p>

<pre><code>@Injectable()
export class HttpResponse extends Response {
    constructor(responseOptions: ResponseOptions) {
        super(responseOptions);
        console.log("RESPONSE IS CREATED!!!!!!!");
    }
}
</code></pre>

<p>The constructor never being called and here it is the bootstrap:</p>

<pre><code>bootstrap(AppComponent,
    [   ROUTER_PROVIDERS
        ,HTTP_PROVIDERS
        ,provide(RequestOptions, {useClass: HttpRequest})
        ,provide(Response, {useClass: HttpResponse})
    ]);
</code></pre>

<p>The reason for overriding the response is to read some response headers and control for 404-Not Page Found globally and ....</p>

<p>Thanks,</p>