title: With Angular's new HttpClient, how can I get all headers when subscribing to the events?
body: <p>I am using Angular 4.3.2 and the new <a href="https://angular.io/api/common/http/HttpClient" rel="noreferrer">HttpClient</a> to download a file sent as a stream, and I need to get the headers (particularly, Content-Disposition), but they don't seem to be present in the response even though I can see the headers being correctly sent with the request in Chrome's dev tools.</p>
  
  <p>This is the code:</p>
  
  <pre class="lang-js prettyprint-override"><code>downloadDocument(documentId: number) {
      const downloadDocumentUrl = `${ this.config.apiUrls.documents }/${ documentId }`;
      const downloadRequest = new HttpRequest('GET', downloadDocumentUrl, {
          reportProgress: true,
          responseType: 'blob'
      });
  
      let percentageDownloaded = 0;
      this.http.request(downloadRequest).subscribe(
          (event: HttpEvent &lt; any &gt; ) =&gt; {
              if (event) {
                  switch (event.type) {
                      case HttpEventType.ResponseHeader:
                          const contentDispositionHeader = event.headers.get('Content-Disposition');
                          console.log(contentDispositionHeader); // Always null here although I expected it to be there.
                          break;
  
                      case HttpEventType.DownloadProgress:
                          if (event.total) {
                              percentageDownloaded = Math.round((event.loaded / event.total) * 100);
                          }
                          break;
  
                      case HttpEventType.Response:
                          const downloadedFile: Blob = event.body;
                          fileSaverSaveAs(downloadedFile, `${ documentId }.pdf`, true); // This is where I'd like to use content-disposition to use the actual file name.
                          break;
                  }
              }
           ,
          (err) =&gt; {}
      );
  }
  </code></pre>
  
  <p>When this code gets called, Chrome reports in the network tab of dev tools the following response headers:</p>
  
  <p>Access-Control-Allow-Credentials:true<br>
  Access-Control-Allow-Origin:<a href="http://localhost:4200" rel="noreferrer">http://localhost:4200</a><br>
  Content-Disposition:attachment; filename=doc5619362.pdf; filename*=UTF-8''doc5619362.pdf<br>
  Content-Length:88379<br>
  Content-Type:application/pdf<br>
  Date:Thu, 03 Aug 2017 09:43:41 GMT<br>
  Server:Kestrel<br>
  Vary:Origin<br>
  X-Powered-By:ASP.NET</p>
  
  <p>Any ideas on how I can access all the headers present in the response? It is not just Content-Disposition that is not present, all of the other headers are not there except for Content-Type.</p>
  
  <p>Thanks!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Here is a working Plunker demonstrating the issue: <a href="https://plnkr.co/edit/UXZuhWYKHrqZCZkUapgC?p=preview" rel="noreferrer">https://plnkr.co/edit/UXZuhWYKHrqZCZkUapgC?p=preview</a></p>