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

Add Version to RestRequest #2209

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/RestSharp/Request/RestRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ public RestRequest(Uri resource, Method method = Method.Get)
/// Can be used to skip container or root elements that do not have corresponding deserialization targets.
/// </summary>
public string? RootElement { get; set; }

/// <summary>
/// HTTP version for the request. Default is Version11.
/// </summary>
public Version Version { get; set; } = HttpVersion.Version11;

/// <summary>
/// When supplied, the function will be called before calling the deserializer
Expand Down
1 change: 1 addition & 0 deletions src/RestSharp/RestClient.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ async Task<HttpResponse> ExecuteRequestAsync(RestRequest request, CancellationTo
message.Content = requestContent.BuildContent();
message.Headers.Host = Options.BaseHost;
message.Headers.CacheControl = request.CachePolicy ?? Options.CachePolicy;
message.Version = request.Version;

using var timeoutCts = new CancellationTokenSource(request.Timeout ?? Options.Timeout ?? _defaultTimeout);
using var cts = CancellationTokenSource.CreateLinkedTokenSource(timeoutCts.Token, cancellationToken);
Expand Down
Loading