Skip to content

Commit c8c8342

Browse files
committedDec 28, 2021
Some cleanup
1 parent 0b2f1dd commit c8c8342

8 files changed

+10
-6
lines changed
 

‎RestSharp.sln.DotSettings

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_PARAMETERS_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
6666
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/PreferQualifiedReference/@EntryValue">False</s:Boolean>
6767
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FDIC/@EntryIndexedValue">FDIC</s:String>
68+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" /&gt;</s:String>
6869
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002EDaemon_002ESettings_002EMigration_002ESwaWarningsModeSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
6970
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
7071
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>

‎src/RestSharp/Parameters/ParametersCollection.cs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
//
1515

1616
using System.Collections;
17-
using System.Collections.Concurrent;
1817
using RestSharp.Authenticators.OAuth.Extensions;
1918

2019
namespace RestSharp;

‎src/RestSharp/Request/HttpRequestMessageExtensions.cs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414
//
1515

16-
using System.Text;
1716
using RestSharp.Extensions;
1817

1918
namespace RestSharp;

‎src/RestSharp/Request/RestRequest.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,18 @@ public RestRequest(Uri resource, Method method = Method.Get, DataFormat dataForm
143143
internal void IncreaseNumAttempts() => Attempts++;
144144

145145
/// <summary>
146-
/// How many attempts were made to send this Request?
146+
/// How many attempts were made to send this Request
147147
/// </summary>
148148
/// <remarks>
149149
/// This number is incremented each time the RestClient sends the request.
150150
/// </remarks>
151151
public int Attempts { get; private set; }
152152

153+
/// <summary>
154+
/// Completion option for <seealso cref="HttpClient"/>
155+
/// </summary>
156+
public HttpCompletionOption CompletionOption { get; set; } = HttpCompletionOption.ResponseContentRead;
157+
153158
/// <summary>
154159
/// Set this to write response to Stream rather than reading into memory.
155160
/// </summary>

‎src/RestSharp/Request/RestRequestExtensions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public static class RestRequestExtensions {
2727
/// <param name="request"></param>
2828
/// <param name="name">Name of the parameter</param>
2929
/// <param name="value">Value of the parameter</param>
30+
/// <param name="encode">Encode the value or not, default true</param>
3031
/// <returns>This request</returns>
3132
public static RestRequest AddParameter(this RestRequest request, string name, object value, bool encode = true)
3233
=> request.AddParameter(new Parameter(name, value, ParameterType.GetOrPost, encode));

‎src/RestSharp/RestClient.Async.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async Task<InternalResponse> ExecuteInternal(RestRequest request, CancellationTo
6969
if (request.OnBeforeRequest != null)
7070
await request.OnBeforeRequest(message);
7171

72-
var responseMessage = await HttpClient.SendAsync(message, ct);
72+
var responseMessage = await HttpClient.SendAsync(message, request.CompletionOption, ct);
7373

7474
if (request.OnAfterRequest != null)
7575
await request.OnAfterRequest(responseMessage);

‎src/RestSharp/RestClient.cs

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using RestSharp.Serializers;
2020
using RestSharp.Serializers.Json;
2121
using RestSharp.Serializers.Xml;
22-
using static System.String;
2322

2423
// ReSharper disable VirtualMemberCallInConstructor
2524
#pragma warning disable 618

‎src/RestSharp/Serializers/Xml/DotNetXmlSerializer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public string Serialize(object obj) {
5151

5252
ns.Add(string.Empty, Namespace);
5353

54-
var serializer = new System.Xml.Serialization.XmlSerializer(obj.GetType());
54+
var serializer = new XmlSerializer(obj.GetType());
5555
var writer = new EncodingStringWriter(Encoding);
5656

5757
serializer.Serialize(writer, obj, ns);

0 commit comments

Comments
 (0)
Please sign in to comment.