Skip to content

Commit 32d913c

Browse files
committed
[bugfix] Return 404 for not found schema id
1 parent a9ec61b commit 32d913c

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/main/java/com/evolvedbinary/bblValidator/controller/SchemaController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public HttpResponse<Object> getSchema(@PathVariable("schema-id") final String sc
4141
final String schema = schemaService.getSchema(schemaId);
4242
if (schema == null) {
4343
return HttpResponse
44-
.badRequest()
44+
.notFound()
4545
.contentType(MediaType.APPLICATION_JSON_TYPE)
4646
.body(new ErrorResponse(ErrorResponse.Code.SCHEMA_NOT_FOUND,"Schema not found with ID: " + schemaId));
4747
}

src/test/java/com/evolvedbinary/bblValidator/controller/SchemaControllerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void getInvalidSchema() {
109109
final HttpClientResponseException exception = assertThrows(HttpClientResponseException.class, () -> client.toBlocking().exchange(request, String.class));
110110

111111
// assert the response status
112-
assertEquals(HttpStatus.BAD_REQUEST, exception.getStatus());
112+
assertEquals(HttpStatus.NOT_FOUND, exception.getStatus());
113113

114114
// assert the X-BBLVALIDATOR-VERSION is present and it's returning the expected value.
115115
assertEquals(version, exception.getResponse().getHeaders().get(BBLVALIDATOR_VERSION_HEADER));

0 commit comments

Comments
 (0)