This repository was archived by the owner on Nov 20, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
test/Microsoft.AspNetCore.WebUtilities.Tests Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,23 @@ public async Task ReadNextPair_ReturnsNullOnEmptyStream(bool bufferRequest)
189
189
Assert . Null ( await ReadPair ( reader ) ) ;
190
190
}
191
191
192
+ // https://en.wikipedia.org/wiki/Percent-encoding
193
+ [ Theory ]
194
+ [ InlineData ( "++=hello" , " " , "hello" ) ]
195
+ [ InlineData ( "a=1+1" , "a" , "1 1" ) ]
196
+ [ InlineData ( "%22%25%2D%2E%3C%3E%5C%5E%5F%60%7B%7C%7D%7E=%22%25%2D%2E%3C%3E%5C%5E%5F%60%7B%7C%7D%7E" , "\" %-.<>\\ ^_`{|}~" , "\" %-.<>\\ ^_`{|}~" ) ]
197
+ [ InlineData ( "a=%41" , "a" , "A" ) ] // ascii encoded hex
198
+ [ InlineData ( "a=%C3%A1" , "a" , "\u00e1 " ) ] // utf8 code points
199
+ [ InlineData ( "a=%u20AC" , "a" , "%u20AC" ) ] // utf16 not supported
200
+ public async Task ReadForm_Decoding ( string formData , string key , string expectedValue )
201
+ {
202
+ var body = MakeStream ( bufferRequest : false , text : formData ) ;
203
+
204
+ var form = await ReadFormAsync ( new FormReader ( body ) ) ;
205
+
206
+ Assert . Equal ( expectedValue , form [ key ] ) ;
207
+ }
208
+
192
209
protected virtual Task < Dictionary < string , StringValues > > ReadFormAsync ( FormReader reader )
193
210
{
194
211
return Task . FromResult ( reader . ReadForm ( ) ) ;
You can’t perform that action at this time.
0 commit comments