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

Null Version in RestResponse<T> #2196

Closed
biasso opened this issue May 14, 2024 · 0 comments · Fixed by #2199
Closed

Null Version in RestResponse<T> #2196

biasso opened this issue May 14, 2024 · 0 comments · Fixed by #2199
Labels

Comments

@biasso
Copy link
Contributor

biasso commented May 14, 2024

Describe the bug
RestResponse<T> always has a null Version.

To Reproduce

using RestSharp;

var client = new RestClient();
var request = new RestRequest("https://dummyjson.com/products/1");

var response = await client.ExecuteAsync(request);
Console.WriteLine($"Version {response.Version}");  // Version 1.1

var response2 = await client.ExecuteAsync<object>(request);
Console.WriteLine($"Version {response2.Version}"); // Version (null)

Expected behavior
RestResponse<T> should have Version set.

Desktop (please complete the following information):

  • OS: all
  • .NET version: all
  • Version: 110.2.0

Additional context
The version is not copied from the RestResponse in this method: https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Response/RestResponse.cs#L35

@biasso biasso added the bug label May 14, 2024
biasso added a commit to biasso/RestSharp that referenced this issue May 18, 2024
alexeyzimarev pushed a commit that referenced this issue May 22, 2024
* Set Version to generic RestResponse

Fix #2196

* Alphabetically sort initialized properties of RestResponse

Sorting the properties alphabetically to improve code readability and makes it easier to locate specific properties during maintenance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant