admin管理员组文章数量:1123399
I have encountered a peculiar scenario where a the same exact api request using fetch
vs Angular's HttpClient
has a difference. Particularly, the Traceparent
and Request-id
are automatically added by fetch
but Angular doesn't.
Given the fact, I also have used the HttpClient now with the following provider added to the ApplicationConfig
:
import { provideHttpClient, withFetch } from '@angular/common/http';
...
provideHttpClient(withFetch())
I was assuming that since HttpClient will use fetch
under the hood because of this declaration of provider that is using withFetch
, it will carry over the two headers just like a raw fetch
would do. But apparently it does not.
So this seems to be a three part question:
- What are these headers?
- How are these attached by
fetch
? - Should I file an issue on Angular's GitHub regarding
HttpCLient
'swithFetch
not exactly doing whatfetch
would do?
本文标签:
版权声明:本文标题:javascript - What is Traceparent and Request-id Http Request Headers? And whyhow does a raw fetch automatically add these while 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736568567a1944739.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论