title: Angular 8 HttpClient GET ignoring responseType: 'blob' from swagger API returning {}
body: <p>Specified a API service in swagger 2.0 like so:</p>
  
  <pre class="lang-yaml prettyprint-override"><code> /example/my-file:
      get:
        summary: Get this file
        tags:
          - MyFile
        produces:
          - application/octet-stream
        responses:
          200:
            description: OK
            schema:
              type: file
          400:
            $ref: "#/responses/badRequest"
          404:
            $ref: "#/responses/notFound"
          500:
            $ref: "#/responses/internalServerError"
  
  </code></pre>
  
  <p>Implemented and can make a Postman GET request that returns the file contents correctly.
  I used ng-swagger-gen to generate an angular service call:</p>
  
  <pre class="lang-js prettyprint-override"><code>getExampleFileResponse(params: ExampleService.GetExampleFileParams): __Observable&lt;__StrictHttpResponse&lt;Blob&gt;&gt; {
      let __params = this.newParams();
      let __headers = new HttpHeaders();
      let __body: any = null;
  
  
      let req = new HttpRequest&lt;any&gt;(
        'GET',
        this.rootUrl + `/example/my-file`,
        __body,
        {
          headers: __headers,
          params: __params,
          responseType: 'blob'
        });
  
      return this.http.request&lt;any&gt;(req).pipe(
        __filter(_r =&gt; _r instanceof HttpResponse),
        __map((_r) =&gt; {
          return _r as __StrictHttpResponse&lt;Blob&gt;;
        })
      );
    }
  
  
    getExampleFile(params: ExampleService.GetExampleFileParams): __Observable&lt;Blob&gt; {
      return this.getExampleFileResponse(params).pipe(
        tap(_r =&gt; console.log(_r)),
        __map(_r =&gt; _r.body as Blob)
      );
    }
  
  </code></pre>
  
  <p>When I call from an angular client:</p>
  
  <pre class="lang-js prettyprint-override"><code>   this.ExampleService.getExampleFile(param)
      .subscribe((f) =&gt; {
        saveAs(f, 'example.txt')
      });
  </code></pre>
  
  <p>I get a Blob consisting of 3 bytes: {}\n
  Not the file contents. It seems like something in the service is not working correctly. If I put a tap() into the service on the response I can see the response is delivering a Blob with those three bytes and a content-type: application/json, not the application/octet-stream I specified in the API.</p>