Skip to content

Setting useragent to null no longer works in 108.0.1 #1905

Closed

Description

@drgrieve

Describe the bug
Setting useragent to null now causes an exception = > The format of value ' ' is invalid

To Reproduce
Old code that worked (no useragent sent in headers)
var client = new RestClient("https://www.example.com.au");
client.UserAgent = null;

New code that fails
var client = new RestClient(new RestClientOptions { BaseUrl = new Uri("https://www.example.com.au"), UserAgent = null });

Stack trace
The format of value ' ' is invalid. Stack at System.Net.Http.Headers.HttpHeaderParser.ParseValue(String value, Object storeValue, Int32& index) at System.Net.Http.Headers.HttpHeaders.ParseAndAddValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info, String value) at System.Net.Http.Headers.HttpHeaders.Add(HeaderDescriptor descriptor, String value) at System.Net.Http.Headers.HttpHeaderValueCollection`1.ParseAdd(String input) at RestSharp.RestClient.ConfigureHttpClient(HttpClient httpClient) at RestSharp.RestCl

Activity

  1. alexeyzimarev commented on Sep 20, 2022

    @alexeyzimarev
    Member

    Maybe you can submit a PR where you check the property value for null and not assign anything.

  2. stale commented on Oct 30, 2022

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  3. repo-ranger commented on Oct 30, 2022

    @repo-ranger

    ⚠️ This issue has been marked wontfix and will be closed in 3 days

  4. stale commented on Jan 7, 2023

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  5. repo-ranger commented on Jan 7, 2023

    @repo-ranger

    ⚠️ This issue has been marked wontfix and will be closed in 3 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions