.NET HttpClient send arbitrary Authorization heade

2019-07-20 16:42发布

Using HttpClient is it possible to construct Authorization headers of arbitrary syntax ?

If I use the syntax HttpClient expects :

HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("OAuth2", <token>);

it will pass this header :

Authorization: OAuth2 <token-value>

However, I'm sending my requests to a remote REST API that requires the authorization header to be in this format :

Authorization: token <token-value>

How to send the required format ?

0条回答
登录 后发表回答