Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

Kërkoni te Asistenca

Shmangni karremëzime gjoja asistence. S’do t’ju kërkojmë kurrë të bëni një thirrje apo të dërgoni tekst te një numër telefoni, apo të na jepni të dhëna personale. Ju lutemi, raportoni veprimtari të dyshimtë duke përdorur mundësinë “Raportoni Abuzim”.

Learn More

Downloading .wav file in Firefox(in others working) using Angular Observable throwing "Http failure response: 0 Unknown Error failed" error

  • 2 përgjigje
  • 1 e ka hasur këtë problem
  • 3 parje
  • Përgjigjja më e re nga akashmittal

more options

Sample Code Snippet:

"downloadFile(payLoad: any): Observable	<HttpResponse<any>> {
   return this.http.post(this.fileDownloadUrl, payLoad,
     { headers: { 'Content-Type': 'application/json' }, observe: 'response', responseType: 'blob' });
 } "

This snippet is working for all other browsers except Firefox. I have tested it on Version 68.0.2 (64-bit), Version 69.0 (64-bit).

Can anyone help on the fix or any alternative way to download wav file in Angular 7?

Sample Code Snippet: "downloadFile(payLoad: any): Observable &lt;HttpResponse&lt;any&gt;&gt; { return this.http.post(this.fileDownloadUrl, payLoad, { headers: { 'Content-Type': 'application/json' }, observe: 'response', responseType: 'blob' }); } " This snippet is working for all other browsers except Firefox. I have tested it on Version 68.0.2 (64-bit), Version 69.0 (64-bit). Can anyone help on the fix or any alternative way to download wav file in Angular 7?

Ndryshuar nga akashmittal

Krejt Përgjigjet (2)

more options

Are the CORS headers set properly? Could you show your header list?

more options

Hi Mesko,

The application don't have any 3rd party dependency thus we have blocked CORS here due to security reason. All resources that application needs are there on single server on which it is deployed. I am sharing the headers for your reference:

Request Header: Host: ******************* User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0 Accept: application/json, text/plain, */* Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate, br Content-Type: application/json X-CSRF-TOKEN: 66f60688-b6ae-44ff-96f1-0ee3cf9c595b Content-Length: 74 DNT: 1 Connection: keep-alive Referer: https://******************************** Cookie: JSESSIONID=ADC4844F95A6711A5AE383D95CD3A424; X-CSRF-TOKEN=66f60688-b6ae-44ff-96f1-0ee3cf9c595b Pragma: no-cache Cache-Control: no-cache

Response Header: HTTP/1.1 200 X-CSRF-HEADER: X-CSRF-TOKEN X-CSRF-PARAM: _csrf X-CSRF-TOKEN: 66f60688-b6ae-44ff-96f1-0ee3cf9c595b Set-Cookie: X-CSRF-TOKEN=66f60688-b6ae-44ff-96f1-0ee3cf9c595b; Path=/; Secure Content-disposition: attachment;filename=temp.wav X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: 0 Strict-Transport-Security: max-age=31536000 ; includeSubDomains X-Frame-Options: SAMEORIGIN Content-Security-Policy: default-src 'self' data: 'unsafe-eval' 'unsafe-inline'; Transfer-Encoding: chunked Date: Mon, 09 Sep 2019 06:25:15 GMT

Hope you can help us on where we are going wrong.

Thanks

Ndryshuar nga akashmittal