File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1616use Illuminate \Http \Response as IlluminateResponse ;
1717use Dingo \Api \Exception \InvalidAcceptHeaderException ;
1818use Symfony \Component \HttpKernel \Exception \NotFoundHttpException ;
19+ use Symfony \Component \HttpKernel \Exception \BadRequestHttpException ;
1920use Illuminate \Routing \RouteCollection as IlluminateRouteCollection ;
2021use Symfony \Component \HttpKernel \Exception \MethodNotAllowedHttpException ;
2122
@@ -341,11 +342,17 @@ protected function attachApiFilters(Route $route)
341342 protected function findRoute ($ request )
342343 {
343344 if ($ this ->isApiRequest ($ request )) {
344- $ route = $ this ->api ->getByVersion ($ this ->currentVersion )-> match ( $ request );
345+ $ routes = $ this ->api ->getByVersion ($ this ->currentVersion );
345346 } else {
346- $ route = $ this ->routes -> match ( $ request ) ;
347+ $ routes = $ this ->routes ;
347348 }
348349
350+ if (! $ routes ) {
351+ throw new BadRequestHttpException ("Requested API version is invalid. " );
352+ }
353+
354+ $ route = $ routes ->match ($ request );
355+
349356 return $ this ->current = $ this ->substituteBindings ($ route );
350357 }
351358
You can’t perform that action at this time.
0 commit comments