為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

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

  • 2 回覆
  • 1 有這個問題
  • 1 次檢視
  • 最近回覆由 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?

由 akashmittal 於 修改

所有回覆 (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

由 akashmittal 於 修改