Skip to content

Commit 4f54f38

Browse files
committed
Merge branch 'mscharrig-develop' into develop
2 parents 398e546 + 1e06bc7 commit 4f54f38

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

RestSharp.Tests/OAuthTests.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ public void PercentEncode_Encodes_Correctly(string value, string expected)
4646
}
4747

4848
[Test]
49-
[TestCase("The quick brown fox jumps over the lazy dog", "rVL90tHhGt0eQ0TCITY74nVL22P%2FltlWS7WvJXpECPs%3D")]
50-
[TestCase("The quick\tbrown\nfox\rjumps\r\nover\t\tthe\n\nlazy\r\n\r\ndog", "C%2B2RY0Hna6VrfK1crCkU%2FV1e0ECoxoDh41iOOdmEMx8%3D")]
51-
[TestCase("", "%2BnkCwZfv%2FQVmBbNZsPKbBT3kAg3JtVn3f3YMBtV83L8%3D")]
52-
[TestCase(" !\"#$%&'()*+,", "xcTgWGBVZaw%2Bilg6kjWAGt%2FhCcsVBMMe1CcDEnxnh8Y%3D")]
53-
public void HmacSha256_Hashes_Correctly(string value, string expected)
49+
[TestCase("The quick brown fox jumps over the lazy dog", "rVL90tHhGt0eQ0TCITY74nVL22P%2FltlWS7WvJXpECPs%3D", "12345678")]
50+
[TestCase("The quick\tbrown\nfox\rjumps\r\nover\t\tthe\n\nlazy\r\n\r\ndog", "C%2B2RY0Hna6VrfK1crCkU%2FV1e0ECoxoDh41iOOdmEMx8%3D", "12345678")]
51+
[TestCase("", "%2BnkCwZfv%2FQVmBbNZsPKbBT3kAg3JtVn3f3YMBtV83L8%3D", "12345678")]
52+
[TestCase(" !\"#$%&'()*+,", "xcTgWGBVZaw%2Bilg6kjWAGt%2FhCcsVBMMe1CcDEnxnh8Y%3D", "12345678")]
53+
[TestCase("AB", "JJgraAxzpO2Q6wiC3blM4eiQeA9WmkALaZI8yGRH4qM%3D", "CD!")]
54+
public void HmacSha256_Hashes_Correctly(string value, string expected, string consumerSecret)
5455
{
55-
string consumerSecret = "12345678";
5656
string actual = OAuthTools.GetSignature(OAuthSignatureMethod.HmacSha256, value, consumerSecret);
5757

5858
Assert.AreEqual(expected, actual);

RestSharp/Authenticators/OAuth/OAuthTools.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ public static string GetSignature(OAuthSignatureMethod signatureMethod,
313313
tokenSecret = string.Empty;
314314

315315
var unencodedConsumerSecret = consumerSecret;
316-
consumerSecret = UrlEncodeRelaxed(consumerSecret);
317-
tokenSecret = UrlEncodeRelaxed(tokenSecret);
316+
consumerSecret = Uri.EscapeDataString(consumerSecret);
317+
tokenSecret = Uri.EscapeDataString(tokenSecret);
318318

319319
string signature;
320320

0 commit comments

Comments
 (0)