Skip to content

Commit 40a1c8b

Browse files
committed
Lowercase OpenAPI operation before path validation
This makes validateRequestPath and validateResponsePath work with httpMethod specified in uppercase, e.g. "GET" instead of "get".
1 parent e59eb33 commit 40a1c8b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/mservicetech/openapi/validation/OpenApiValidator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public Status validateRequestPath (String requestURI , String httpMethod, Reques
133133
requireNonNull(openApiHelper, "openApiHelper object cannot be null");
134134
OpenApiOperation openApiOperation;
135135
try {
136-
openApiOperation = getOpenApiOperation(requestURI, httpMethod);
136+
openApiOperation = getOpenApiOperation(requestURI, httpMethod.toLowerCase());
137137
if (openApiOperation == null) {
138138
return new Status(STATUS_INVALID_REQUEST_PATH, requestURI);
139139
}
@@ -440,7 +440,7 @@ protected Status validateResponseContent(Object responseContent, OpenApiOperatio
440440
public Status validateResponsePath(String requestURI, String httpMethod, String statusCode, ResponseEntity responseEntity) {
441441
OpenApiOperation openApiOperation;
442442
try {
443-
openApiOperation = getOpenApiOperation(requestURI, httpMethod);
443+
openApiOperation = getOpenApiOperation(requestURI, httpMethod.toLowerCase());
444444
if (openApiOperation == null) {
445445
return new Status(STATUS_INVALID_REQUEST_PATH, requestURI);
446446
}

0 commit comments

Comments
 (0)