簡體   English   中英

有沒有辦法注入觀察:來自Angular 6的HttpInterceptor的“響應”?

[英]Is there a way to inject observe: 'response' from HttpInterceptor in Angular 6?

我的應用使用以下this來從Web api接收響應中的自定義標頭。_http.get(“ SomeUrl”,{observe:“ response”}); 我能夠在HttpInterceptor中設置標頭和參數,以進行所有api調用並接收帶有自定義標頭的響應。 我的問題是,是否有一種方法可以像我們可以全局設置標頭和參數一樣在HttpInterceptor中為所有api調用設置{observe:“ response”}? 任何幫助,將不勝感激。

{觀察: “響應”}); 必須始終與http方法調用一起作為參數。 然后可以在HttpInterceptor中讀取自定義響應標頭。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM