File Download error:SyntaxError: Unexpected token M in JSON at position 0 Angular 11 HttpPost

153 views
Skip to first unread message

Sachin Kulkarni

unread,
May 12, 2021, 2:54:57 AM5/12/21
to Angular and AngularJS discussion

I am getting above mentioned error while trying to download a file in angular 11. Status Code is 200 OK .Asp.Net Web Api is used to post file.

Below is the Code.

this.http.post<Blob>(url,{responseType: 'blob'}).subscribe({ next: versionfiledata=>{ return versionfiledata; }, error: error => { console.error('There was an error!', error); } } )

Error:SyntaxError: Unexpected token M in JSON at position 0


Please reply urgently.


Regards,


Sachin Kulkarni

Ajithkumar R

unread,
May 12, 2021, 12:17:33 PM5/12/21
to ang...@googlegroups.com
Hi sachin,
    Please check the post data and header.

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/93395a1e-6e2e-422a-a43e-a610d40b6917n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages