title: Angular Downloading a file using contenturl with Basic Authentication
body: <p>I have a contentUrl when user clicks on that,file should be downloaded.
  If I try to browse the contentUrl in the browser it asks for Userid and password.I believe this is Basic Authentication.I dont want user to enter UserId and Password so I am passing it Authorization(Please see below code).
  Url looks some thing like this: 
  <a href="http://XXX.XXX.XX.XXX:8080/flowable-rest/service/runtime/tasks/90875/attachments/90555/content" rel="nofollow noreferrer">http://XXX.XXX.XX.XXX:8080/flowable-rest/service/runtime/tasks/90875/attachments/90555/content</a></p>
  
  <pre><code>let username : string = 'admin';
  let pwd : string = 'test';
  
  let headers = new Headers();
  headers.set('Accept', 'text/json'); 
  headers.append('Content-Type', 'application/json');
  headers.set('Access-Control-Allow-Origin', '*');
  headers.set('Access-Control-Allow-Methods','POST, GET, OPTIONS, PUT, DELETE');
  headers.set('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
  headers.append("Authorization", "Basic " + btoa(username + ":" + pwd)); 
  return this.http.get(url, { headers: headers })
      .pipe(map(r =&gt; {
          console.log(r);           
  
      })).pipe(catchError(this.handleError));
  </code></pre>
  
  <p>I am not 100% sure whether this approach is fine for my requirement.</p>
  
  <p>I tried contentUrl in the PostMan.In PostMan down right corner 'Download' button appeared and asked me to download.Below is the message it says</p>
  
  <p>This response could not be previewed. Download the response to open it with an appropriate application. </p>
  
  <p>If I click on Download my attachment is getting downloaded.</p>
  
  <p>Pro-grammatically is http.get equivalent to Download? If not how should I code it? Basically my requirement is if I click on the link attachment should be downloaded.</p>
  
  <p><a href="https://i.stack.imgur.com/H4zNK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H4zNK.png" alt="PostMan Execution"></a></p>