问题
My app receives a custom header in response from web api using the following this._http.get("SomeUrl", {observe:"response"}); I'm able to set the headers and params in HttpInterceptor to make all api calls and receive the response with custom header. My question is if there is a way to set {observe:"response"} in HttpInterceptor for all the api calls just like we can set headers and parameters globally? Any help would be appreciated.
回答1:
{observe:"response"}); has to be always along with the http method call as an argument. Custom response header then could be read in HttpInterceptor.
来源:https://stackoverflow.com/questions/52448703/is-there-a-way-to-inject-observe-response-from-httpinterceptor-in-angular-6