File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,32 @@ async fn f() -> Result<(), BoxError> {
274274 Ok ( ( ) )
275275}
276276
277+ #[ it( "should not allow user to send the reserved paths" ) ]
278+ async fn f ( ) -> Result < ( ) , BoxError > {
279+ let serve: Serve = serve ( ) . await ;
280+
281+ let client = Client :: new ( ) ;
282+ for reserved_path in piping_server:: piping_server:: reserved_paths:: VALUES {
283+ let uri = format ! ( "http://{}{}" , serve. addr, reserved_path) . parse :: < http:: Uri > ( ) ?;
284+
285+ let get_req = hyper:: Request :: builder ( )
286+ . method ( hyper:: Method :: POST )
287+ . uri ( uri. clone ( ) )
288+ . body ( hyper:: Body :: from ( "this is a content" ) ) ?;
289+ let get_res = client. request ( get_req) . await ?;
290+ let ( get_parts, _) = get_res. into_parts ( ) ;
291+
292+ assert_eq ! ( get_parts. status, http:: StatusCode :: BAD_REQUEST ) ;
293+ assert_eq ! (
294+ get_header_value( & get_parts. headers, "access-control-allow-origin" ) ,
295+ Some ( "*" )
296+ ) ;
297+ }
298+
299+ serve. shutdown ( ) . await ?;
300+ Ok ( ( ) )
301+ }
302+
277303#[ it( "should return a HEAD response with the same headers as GET response in the reserved paths" ) ]
278304async fn f ( ) -> Result < ( ) , BoxError > {
279305 let serve: Serve = serve ( ) . await ;
You can’t perform that action at this time.
0 commit comments