title: How to switch between response types in Angular?
body: <p>I have the following function</p>
  <pre><code>  getFile(oid){
      return this.http.get(`https://localhost:44320/api/getfile`, {params: {oid}})
    }
  </code></pre>
  <p>The problem is that the response is either of type <code>JSON</code> or <code>Blob</code> if I include <code>responseType: 'Blob'</code> the json value is not parsed correctly but if I dont include it the <code>Blob</code> file is not parsed correctly. How could I distinguish the two response types? For example, if two or more files were found the API returns <code>{type: number, filename: string}[]</code> else the file (PDF) itself is returned.</p>