Skip to content

Commit 150e5fe

Browse files
committed
+ added test for #231
1 parent 8ec8400 commit 150e5fe

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

RestSharp.IntegrationTests/oAuth1Tests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,20 @@ public void Properly_Encodes_Parameter_Names()
171171

172172
Assert.Equal("name%5Bfirst%5D", sortedParams[0].Name);
173173
}
174+
175+
[Fact]
176+
public void Use_RFC_3986_Encoding_For_Auth_Signature_Base()
177+
{
178+
// reserved characters for 2396 and 3986
179+
var reserved2396Characters = new[] { ";", "/", "?", ":", "@", "&", "=", "+", "$", "," }; // http://www.ietf.org/rfc/rfc2396.txt
180+
var additionalReserved3986Characters = new[] { "!", "*", "'", "(", ")" }; // http://www.ietf.org/rfc/rfc3986.txt
181+
var reservedCharacterString = string.Join( string.Empty, reserved2396Characters.Union( additionalReserved3986Characters ) );
182+
183+
// act
184+
var escapedString = OAuthTools.UrlEncodeRelaxed( reservedCharacterString );
185+
186+
// assert
187+
Assert.Equal( "%3B%2F%3F%3A%40%26%3D%2B%24%2C%21%2A%27%28%29", escapedString );
188+
}
174189
}
175190
}

0 commit comments

Comments
 (0)