7

I am using Angular 4. Also used the http interceptor for any http request. https://angular.io/api/common/http/HttpInterceptor

But I am using one of the post request using xmlHttpRequest for some file upload event. headers are setting properly in http post request (this.http.post(...)). But In xmlHttpRequest, interceptor is not being called. so cannot set the header. How can i handle the http interceptor in xmlHttpRequest(post method)?

vik
  • 105
  • 13

2 Answers2

0

Interceptor transform any request GET/POST/PUT..might be something is missing in code. Can you please share your code so that i can check issue. Also you can refer this blog..given very simple way of Interceptor implementation with example.

Prashant M Bhavsar
  • 1,136
  • 9
  • 13
-1

Interceptor will work just for request which is made by HttpClient, why that is not working. Even you can try to make request with old Http module from angular instead of HttpClient, also it won't work.

Efe
  • 5,180
  • 2
  • 21
  • 33