Skip to content

Commit

Permalink
Add Version (#2209)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyzimarev committed May 27, 2024
1 parent 7334e28 commit 852c804
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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 @@ public partial class RestClient {
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

0 comments on commit 852c804

Please sign in to comment.