File tree Expand file tree Collapse file tree 2 files changed +25
-8
lines changed Expand file tree Collapse file tree 2 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,21 @@ public async Task HttpGet_BasicTest()
5656 Assert . Equal ( Snapshot . Current ( ) , Snapshot . New ( result ) ) ;
5757 }
5858
59+ [ Fact ]
60+ public async Task HttpGet_ForwardToNextMiddleware ( )
61+ {
62+ // arrange
63+ TestServer server = CreateTestServer ( ) ;
64+ string query = "{ basic { a } }" ;
65+
66+ // act
67+ HttpResponseMessage message = await server . CreateClient ( )
68+ . GetAsync ( $ "http://localhost:5000/1234") ;
69+
70+ // assert
71+ Assert . Equal ( HttpStatusCode . NotFound , message . StatusCode ) ;
72+ }
73+
5974 [ Fact ]
6075 public async Task HttpPost_WithScalarVariables ( )
6176 {
Original file line number Diff line number Diff line change @@ -10,20 +10,22 @@ internal static class GetRequest
1010
1111 internal static bool IsGet ( this HttpRequest request )
1212 {
13- return request . Method . Equals ( _getMethod , StringComparison . OrdinalIgnoreCase ) ;
13+ return request . Method . Equals ( _getMethod , StringComparison . OrdinalIgnoreCase )
14+ && HasQueryParameter ( request . HttpContext ) ;
1415 }
1516
1617 internal static QueryRequest ReadRequest ( HttpContext context )
1718 {
18- string query = string . Empty ;
19-
20- if ( context . Request . QueryString . HasValue &&
21- context . Request . Query . ContainsKey ( _queryIdentifier ) )
19+ return new QueryRequest ( )
2220 {
23- query = context . Request . Query [ _queryIdentifier ] . ToString ( ) ;
24- }
21+ Query = context . Request . Query [ _queryIdentifier ] . ToString ( )
22+ } ;
23+ }
2524
26- return new QueryRequest ( ) { Query = query } ;
25+ private static bool HasQueryParameter ( HttpContext context )
26+ {
27+ return context . Request . QueryString . HasValue &&
28+ context . Request . Query . ContainsKey ( _queryIdentifier ) ;
2729 }
2830 }
2931}
You can’t perform that action at this time.
0 commit comments