Skip to content

Commit 0048dda

Browse files
Merge pull request restsharp#897 from Bobs13/master
changed Regex suffix to static
2 parents 20c5e24 + 2cd51e6 commit 0048dda

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

RestSharp/RestClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public void AddHandler(string contentType, IDeserializer deserializer)
201201
{
202202
this.ContentHandlers[contentType] = deserializer;
203203

204-
if (contentType != "*" && !this.structuredSyntaxSuffixWildcardRegex.IsMatch(contentType))
204+
if (contentType != "*" && !structuredSyntaxSuffixWildcardRegex.IsMatch(contentType))
205205
{
206206
this.AcceptTypes.Add(contentType);
207207
// add Accept header based on registered deserializers
@@ -268,7 +268,7 @@ private IDeserializer GetHandler(string contentType)
268268
}
269269

270270
// https://tools.ietf.org/html/rfc6839#page-4
271-
Match structuredSyntaxSuffixMatch = this.structuredSyntaxSuffixRegex.Match(contentType);
271+
Match structuredSyntaxSuffixMatch = structuredSyntaxSuffixRegex.Match(contentType);
272272

273273
if (structuredSyntaxSuffixMatch.Success)
274274
{
@@ -293,9 +293,9 @@ private IDeserializer GetHandler(string contentType)
293293

294294
private readonly Regex structuredSyntaxSuffixWildcardRegex = new Regex(@"^\*\+\w+$");
295295
#else
296-
private readonly Regex structuredSyntaxSuffixRegex = new Regex(@"\+\w+$", RegexOptions.Compiled);
296+
private static readonly Regex structuredSyntaxSuffixRegex = new Regex(@"\+\w+$", RegexOptions.Compiled);
297297

298-
private readonly Regex structuredSyntaxSuffixWildcardRegex = new Regex(@"^\*\+\w+$", RegexOptions.Compiled);
298+
private static readonly Regex structuredSyntaxSuffixWildcardRegex = new Regex(@"^\*\+\w+$", RegexOptions.Compiled);
299299
#endif
300300

301301
private void AuthenticateIfNeeded(RestClient client, IRestRequest request)

0 commit comments

Comments
 (0)