File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
src/main/java/com/networknt/aws/lambda/handler/middleware/specification Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ public class OpenApiMiddleware implements MiddlewareHandler {
2525 public static final String OPENAPI_CONFIG_NAME = "openapi-validator" ;
2626 private static final Logger LOG = LoggerFactory .getLogger (OpenApiMiddleware .class );
2727 private static final String STATUS_METHOD_NOT_ALLOWED = "ERR10008" ;
28+ private static final String STATUS_INVALID_REQUEST_PATH = "ERR10007" ;
2829 private static final String CONFIG_NAME = "openapi" ;
2930 static ValidatorConfig CONFIG = ValidatorConfig .load ();
3031 private static final String SPEC_INJECT = "openapi-inject" ;
@@ -58,6 +59,9 @@ public Status execute(LightLambdaExchange exchange) {
5859 }
5960 final Optional <NormalisedPath > maybeApiPath = helper .findMatchingApiPath (requestPath );
6061
62+ if (maybeApiPath .isEmpty ()) {
63+ return new Status (STATUS_INVALID_REQUEST_PATH , requestPath .normalised ());
64+ }
6165 final NormalisedPath openApiPathString = maybeApiPath .get ();
6266 final Path path = helper .openApi3 .getPath (openApiPathString .original ());
6367
You can’t perform that action at this time.
0 commit comments