@@ -173,17 +173,25 @@ internal RouterExecutionResult Execute ( HttpContext context ) {
173
173
}
174
174
}
175
175
176
- if ( matchResult == RouteMatchResult . NotMatched && NotFoundErrorHandler is not null ) {
177
- return new RouterExecutionResult ( NotFoundErrorHandler ( context ) , null , matchResult , null ) ;
176
+ if ( matchResult == RouteMatchResult . NotMatched ) {
177
+ if ( NotFoundErrorHandler is not null ) {
178
+ return new RouterExecutionResult ( NotFoundErrorHandler ( context ) , null , matchResult , null ) ;
179
+ }
180
+ else {
181
+ return new RouterExecutionResult ( new HttpResponse ( HttpStatusCode . NotFound ) , null , matchResult , null ) ;
182
+ }
178
183
}
179
184
else if ( matchResult == RouteMatchResult . OptionsMatched ) {
180
- HttpResponse corsResponse = new HttpResponse ( ) ;
181
-
182
- return new RouterExecutionResult ( corsResponse , null , matchResult , null ) ;
185
+ return new RouterExecutionResult ( new HttpResponse ( HttpStatusCode . OK ) , null , matchResult , null ) ;
183
186
}
184
- else if ( matchResult == RouteMatchResult . PathMatched && MethodNotAllowedErrorHandler is not null ) {
187
+ else if ( matchResult == RouteMatchResult . PathMatched ) {
185
188
context . MatchedRoute = matchedRoute ;
186
- return new RouterExecutionResult ( MethodNotAllowedErrorHandler ( context ) , matchedRoute , matchResult , null ) ;
189
+ if ( MethodNotAllowedErrorHandler is not null ) {
190
+ return new RouterExecutionResult ( MethodNotAllowedErrorHandler ( context ) , matchedRoute , matchResult , null ) ;
191
+ }
192
+ else {
193
+ return new RouterExecutionResult ( new HttpResponse ( HttpStatusCode . MethodNotAllowed ) , matchedRoute , matchResult , null ) ;
194
+ }
187
195
}
188
196
else if ( matchResult == RouteMatchResult . FullyMatched && matchedRoute is not null ) {
189
197
context . MatchedRoute = matchedRoute ;
0 commit comments