sjclark76 / Bard

https://docs.bard.net.nz
MIT License
29 stars 9 forks source link

Headers not inherited from HttpClient #31

Closed valters-tomsons closed 4 years ago

valters-tomsons commented 4 years ago

Endpoint I am trying to test requires authorization key in headers. For some reason, Bard does not inherit headers added to HttpClient.

Here is how I am setting the Header value

I am reusing the same HttpClient I use in my application, calling like this inherits headers mentioned above.

Only difference I noticed is I am using SendAsync(method, route) instead of GetAsync(route), but I tried replacing the call with SendAsync and that did not work.

sjclark76 commented 4 years ago

Hi could you show me the test set up please.

valters-tomsons commented 4 years ago

Hi, this is the test in question: https://github.com/FaithLV/spectabis-next/blob/master/Tests/ServiceTests/Integration/GetGameBoxArtTest.cs

sjclark76 commented 4 years ago

Hi there.. Yeah my bad. The framework actually creates a new instance of your HTTP client to insert logging code in via a message handler. I'd forgotten to copy across the default headers. here is a link to the code

Thanks for the feedback.

Fix should be in version 4.0.1.

Cheers Stuart.