@@ -348,30 +348,31 @@ Task HandleRequestAsync(Type requestType, HttpContext httpContext)
348348 {
349349 handler ( pathBuilder , operation , routeVerb , route . Path ) ;
350350 }
351- }
352-
353- // Add /custom/path.{format} routes for GET requests
354- if ( routeVerbs . Contains ( HttpMethods . Get ) && ! route . Path . Contains ( '.' ) && ! route . Path . Contains ( '*' ) )
355- {
356- var routePath = route . Path + ".{format}" ;
357- if ( existingRoutes . TryGetValue ( routePath , out var prevRoute ) )
358- {
359- LogManager . GetLogger ( GetType ( ) ) . WarnFormat ( "Ignoring registering duplicate route: {0} for {1} and {2}" ,
360- routePath ,
361- route . RequestType . FullName ,
362- prevRoute . RequestType . FullName ) ;
363- }
364- else
351+
352+ // Add /custom/path.{format} routes
353+ if ( ! route . Path . Contains ( '.' ) && ! route . Path . Contains ( '*' ) )
365354 {
366- routeRule = $ "[GET] { routePath } ";
367- existingRoutes [ routePath ] = route ;
368- var pathBuilder = routeBuilder . MapMethods ( routePath , EndpointVerbs [ HttpMethods . Get ] ,
369- ( string format , HttpResponse response , HttpContext httpContext ) =>
370- HandleRequestAsync ( requestType , httpContext ) ) ;
355+ var routePath = route . Path + ".{format}" ;
356+ if ( existingRoutes . TryGetValue ( routePath , out var prevRoute ) )
357+ {
358+ LogManager . GetLogger ( GetType ( ) ) . WarnFormat ( "Ignoring registering duplicate route: {0} for {1} and {2}" ,
359+ routePath ,
360+ route . RequestType . FullName ,
361+ prevRoute . RequestType . FullName ) ;
362+ }
363+ else
364+ {
365+ routeRule = $ "[{ verb } ] { routePath } ";
366+ existingRoutes [ routePath ] = route ;
367+ var pathBuilderFmt = routeBuilder . MapMethods ( routePath , verb ,
368+ ( string format , HttpResponse response , HttpContext httpContext ) =>
369+ HandleRequestAsync ( requestType , httpContext ) ) ;
371370
372- ConfigureOperationEndpoint ( pathBuilder , operation , options )
373- . WithMetadata < string > ( routePath ) ;
371+ ConfigureOperationEndpoint ( pathBuilderFmt , operation , options )
372+ . WithMetadata < string > ( routePath ) ;
373+ }
374374 }
375+
375376 }
376377 }
377378 catch ( Exception e )
0 commit comments