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

Set UserAgent as a default header parameter #2157

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

PetesBreenCoding
Copy link
Contributor

@PetesBreenCoding PetesBreenCoding commented Nov 3, 2023

Description

When a UserAgent is set in the RestClientOptions passed to the RestClient constructor, the UserAgent is now set as a HTTP header in the DefaultParameters property rather than modifying the HttpClient instance. This is so that the HttpClient instance can be re-used for APIs etc that require different UserAgent headers.

The ConfigureHttpClient method still sets the max timeout as that's set on the client instance itself, not a HTTP header.

I did not modify the "ExpectContinue" behaviour as it seems to have complex logic around parsing values rather than just directly setting them. If this is something you'd like to be in the DefaultParameters property too I can consider that.

Purpose

This pull request is a:

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@PetesBreenCoding
Copy link
Contributor Author

@dotnet-policy-service agree [company="{your company}"]

@dotnet-policy-service agree

@PetesBreenCoding PetesBreenCoding marked this pull request as ready for review November 3, 2023 14:50
@alexeyzimarev alexeyzimarev merged commit f3642c1 into restsharp:dev Dec 14, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants