File tree Expand file tree Collapse file tree 2 files changed +8
-14
lines changed
src/JsonApiDotNetCore/QueryStrings
test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public void ReadAll(DisableQueryStringAttribute? disableQueryStringAttribute)
4040 {
4141 if ( parameterName . Length == 0 )
4242 {
43- throw new InvalidQueryException ( "Empty query string parameter name." , null ) ;
43+ continue ;
4444 }
4545
4646 IQueryStringParameterReader ? reader = _parameterReaders . FirstOrDefault ( nextReader => nextReader . CanRead ( parameterName ) ) ;
Original file line number Diff line number Diff line change @@ -63,28 +63,22 @@ public async Task Can_use_unknown_query_string_parameter()
6363 httpResponse . ShouldHaveStatusCode ( HttpStatusCode . OK ) ;
6464 }
6565
66- [ Fact ]
67- public async Task Cannot_use_empty_query_string_parameter_name ( )
66+ [ Theory ]
67+ [ InlineData ( "" ) ]
68+ [ InlineData ( "foo" ) ]
69+ public async Task Should_ignore_query_parameter_with_empty_name ( string parameterValue )
6870 {
6971 // Arrange
7072 var options = ( JsonApiOptions ) _testContext . Factory . Services . GetRequiredService < IJsonApiOptions > ( ) ;
7173 options . AllowUnknownQueryStringParameters = false ;
7274
73- const string route = "calendars?=" ;
75+ string route = $ "calendars?={ parameterValue } ";
7476
7577 // Act
76- ( HttpResponseMessage httpResponse , Document responseDocument ) = await _testContext . ExecuteGetAsync < Document > ( route ) ;
78+ ( HttpResponseMessage httpResponse , Document _ ) = await _testContext . ExecuteGetAsync < Document > ( route ) ;
7779
7880 // Assert
79- httpResponse . ShouldHaveStatusCode ( HttpStatusCode . BadRequest ) ;
80-
81- responseDocument . Errors . ShouldHaveCount ( 1 ) ;
82-
83- ErrorObject error = responseDocument . Errors [ 0 ] ;
84- error . StatusCode . Should ( ) . Be ( HttpStatusCode . BadRequest ) ;
85- error . Title . Should ( ) . Be ( "Empty query string parameter name." ) ;
86- error . Detail . Should ( ) . BeNull ( ) ;
87- error . Source . Should ( ) . BeNull ( ) ;
81+ httpResponse . ShouldHaveStatusCode ( HttpStatusCode . OK ) ;
8882 }
8983
9084 [ Theory ]
You can’t perform that action at this time.
0 commit comments