Skip to content

No charset in url-encoded form in RestSharp 109.0.1 #2037

Description

@RudiSzalai

Describe the bug
no cookie in the restresponse cookies containter with .NET 7.0 and RestSharp 109.0.1

To Reproduce

var options109 = new RestClientOptions($"{realm.ConfigSource}")
{
         RemoteCertificateValidationCallback = (restclientsender, certificate, chain, sslPolicyErrors) => true,
         MaxTimeout = -1,
};

var restclient = new RestClient(options109);

var loginrequest = new RestRequest();
                
loginrequest.Resource = "login";
loginrequest.Method = Method.Post;
loginrequest.AddParameter("username", realm.Username);
loginrequest.AddParameter("password", realm.Password);
               
var loginresult = await restclient.ExecuteAsync(loginrequest).ConfigureAwait(false);
               

The exact same code returns a cookie on .NET 6 and RestSharp 108.0.3

Stack trace
no exception or any errors

Desktop (please complete the following information):

  • OS: Azure Function
  • .NET version .NET 7.0
  • Version 109.0.1

Additional context
The differences in the restresponse between the two versions:

108
ContentHeaders: (there is only 1, and the ContentType is empty)
{HeaderParameter { Name = Content-Type, Value = text/html; charset=utf-8, Type = HttpHeader, Encode = False, ContentType = }}

ContentLength = null
RawBytes = {byte[695223]}

109
ContentHeaders: (there are 1, and the ContentType is text/plain)
{HeaderParameter { Name = Content-Type, Value = text/html; charset=utf-8, Type = HttpHeader, Encode = False, ContentType = text/plain }}
{HeaderParameter { Name = Content-Length, Value = 2352, Type = HttpHeader, Encode = False, ContentType = text/plain }}

ContentLength = 2352
RawBytes = {byte[2352]}

I need to use .NET 7.0 and on that platform:
108.0.3 has a bug and throws an exception explained here: https://github.com/restsharp/RestSharp/issues/1969
109.0.1 doesn't work with the above issue.

If someone gives me a solution/workaround I'll happily contribute $50 for this project, because currently I can't do my work as nothing works since the .NET 7.0 upgrade.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions