File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,45 @@ public async Task The_query_does_not_require_a_question_mark()
141141 response . StatusCode . Should ( ) . Be ( HttpStatusCode . OK ) ;
142142 }
143143
144+ [ Fact ]
145+ public async Task Can_match_path_with_pipe_character ( )
146+ {
147+ // Arrange
148+ var mock = new HttpMock ( ) ;
149+ var key = $ "{ Guid . NewGuid ( ) } |{ Guid . NewGuid ( ) } ";
150+
151+ mock . ForDelete ( )
152+ . WithPath ( $ "IncomeRelations/{ key } ")
153+ . RespondsWithStatus ( HttpStatusCode . OK ) ;
154+
155+ // Act
156+ var client = mock . GetClient ( ) ;
157+ var response = await client . DeleteAsync ( $ "https://localhost/IncomeRelations/{ key } ") ;
158+
159+ // Assert
160+ response . StatusCode . Should ( ) . Be ( HttpStatusCode . OK ) ;
161+ }
162+
163+ [ Fact ]
164+ public async Task Can_match_query_with_pipe_character ( )
165+ {
166+ // Arrange
167+ var mock = new HttpMock ( ) ;
168+ var filter = "status=active|pending" ;
169+
170+ mock . ForGet ( )
171+ . WithPath ( "api/items" )
172+ . WithQuery ( $ "filter={ filter } ")
173+ . RespondsWithStatus ( HttpStatusCode . OK ) ;
174+
175+ // Act
176+ var client = mock . GetClient ( ) ;
177+ var response = await client . GetAsync ( $ "https://localhost/api/items?filter={ filter } ") ;
178+
179+ // Assert
180+ response . StatusCode . Should ( ) . Be ( HttpStatusCode . OK ) ;
181+ }
182+
144183 [ Fact ]
145184 public async Task Can_mock_get_request_with_json_response ( )
146185 {
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ public async Task<bool> Matches(RequestInfo request)
8585 // Check path pattern if specified
8686 if ( PathPattern != null )
8787 {
88- var path = request . Uri ? . AbsolutePath ?? string . Empty ;
88+ var path = WebUtility . UrlDecode ( request . Uri ? . AbsolutePath ?? string . Empty ) ;
8989 if ( ! MatchesPattern ( path . TrimStart ( '/' ) , PathPattern . TrimStart ( '/' ) ) )
9090 {
9191 return false ;
You can’t perform that action at this time.
0 commit comments