title: Change responseType in angular (5) after receiving response
body: <p>Is there a way to change response type in <em>post</em> method (angular 5) AFTER receiving response?<br>
  <em>The issue:</em> when the response is okay I need responseType to be <em>blob</em>. If not - I need the <em>json</em> responseType.<br>
  I've done some googling around but was unable to find the answer that fully suit my situation.<br>
  <em>Code sample (briefly):</em></p>
  
  <pre><code>// just simple method in service
  
  export class MyService {
  
    constructor(private http: HttpClient) {}
  
    doSomething(data, fileName): Observable&lt;any&gt; {
      return this.http.post('url', data, {
        headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded'),
        params: new HttpParams().set('fileName', fileName),
        responseType: 'blob'
      })
    }
  }
  
  // just classic method in component
  
  export class MyComponent {
  
    constructor(private myService: MyService) {}
  
    this.myService.doSomething(this.data, this.file).subscribe(() =&gt; {
      // here doing something useful
    }, (error: HttpErrorResponse) =&gt; {
      // handling the error
    })
  }
  </code></pre>
  
  <p>So, one more time, in that case everytime I get the response in blob and it's great if all is fine. But if I've got error I need response to be in json. And vice versa.<br>
  <em>How can I</em> set correct responseType in both situations?
  Thanks in advance.</p>