Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpFactory keeps adding 'Accept' headers #41

Closed
hanssens opened this issue Jul 22, 2021 · 2 comments
Closed

HttpFactory keeps adding 'Accept' headers #41

hanssens opened this issue Jul 22, 2021 · 2 comments
Labels

Comments

@hanssens
Copy link
Owner

hanssens commented Jul 22, 2021

When using HttpFactory in a DI scenario, e.g. like in services.AddHttpClient<SomeClient>(), it may keep adding Accept headers to the request. Eventually resulting in 400 BadRequest error. Not sure if its limited to registering it Transient or Singleton, either way this should not occur.

@hanssens hanssens added the bug label Jul 22, 2021
@hanssens
Copy link
Owner Author

Example response:

{"error":"[BadRequest] Method: GET, RequestUri: 'https://<some-endpoint>', 
Version: 1.1, 
Content: System.Net.Http.StringContent, 
Headers:\r\n{\r\n  apikey: <some-api-key> \r\n  
Accept: application/json\r\n  
Accept: application/json\r\n  
Accept: application/json\r\n  
Accept: application/json\r\n  
Accept: application/json\r\n  
Accept: application/json\r\n  
Accept: application/json\r\n  
Accept: application/json\r\n  
... etc.

Accept: application/json\r\n  
Request-Context: appId=cid-v1:e247526a-7e45-4e4f-8446-e470f0ec1d40\r\n  
Request-Id: |35e851730f03d94fae874d4f7204da3c.fe5192a33f62fd4c.\r\n  
traceparent: 00-35e851730f03d94fae874d4f7204da3c-fe5192a33f62fd4c-00\r\n  
Content-Type: application/json; charset=utf-8\r\n  
Content-Length: 0\r\n}"}

@hanssens
Copy link
Owner Author

Fixed in release v2.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant