Skip to content

Setting useragent to null no longer works in 108.0.1 #1905

@drgrieve

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

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