Skip to content

Commit

Permalink
Return 404 if no schema found (apache#1659)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgodave authored and merlimat committed Apr 27, 2018
1 parent db89cd4 commit fa3be03
Showing 1 changed file with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,23 @@ public void getSchema(
pulsar().getSchemaRegistryService().getSchema(schemaId)
.handle((schema, error) -> {
if (isNull(error)) {
response.resume(
Response.ok()
.encoding(MediaType.APPLICATION_JSON)
.entity(GetSchemaResponse.builder()
.version(schema.version)
.type(schema.schema.getType())
.timestamp(schema.schema.getTimestamp())
.data(new String(schema.schema.getData()))
.properties(schema.schema.getProps())
if (isNull(schema)) {
response.resume(Response.status(Response.Status.NOT_FOUND).build());
} else {
response.resume(
Response.ok()
.encoding(MediaType.APPLICATION_JSON)
.entity(GetSchemaResponse.builder()
.version(schema.version)
.type(schema.schema.getType())
.timestamp(schema.schema.getTimestamp())
.data(new String(schema.schema.getData()))
.properties(schema.schema.getProps())
.build()
)
.build()
)
.build()
);
);
}
} else {
response.resume(error);
}
Expand All @@ -122,7 +126,9 @@ public void getSchema(
pulsar().getSchemaRegistryService().getSchema(schemaId, v)
.handle((schema, error) -> {
if (isNull(error)) {
if (schema.schema.isDeleted()) {
if (isNull(schema)) {
response.resume(Response.status(Response.Status.NOT_FOUND).build());
} else if (schema.schema.isDeleted()) {
response.resume(Response.noContent());
} else {
response.resume(
Expand Down

0 comments on commit fa3be03

Please sign in to comment.