diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/SchemasResourceBase.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/SchemasResourceBase.java index b9533c6f29192..eef81a98c5ba0 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/SchemasResourceBase.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/SchemasResourceBase.java @@ -258,7 +258,7 @@ private static void handleGetSchemaResponse(AsyncResponse response, SchemaAndMet response.resume(Response.status( Response.Status.NOT_FOUND.getStatusCode(), "Schema is deleted").build()); } else { - response.resume(Response.ok().encoding(MediaType.APPLICATION_JSON) + response.resume(Response.ok() .entity(convertSchemaAndMetadataToGetSchemaResponse(schema)).build()); } } else { @@ -275,7 +275,7 @@ private static void handleGetAllSchemasResponse(AsyncResponse response, List response = new CompletableFuture(); + schemas.asyncGetRequest(path, new InvocationCallback() { + + @Override + public void completed(javax.ws.rs.core.Response getSchemaResponse) { + response.complete(getSchemaResponse); + } + + @Override + public void failed(Throwable throwable) { + response.completeExceptionally(throwable); + } + }); + MultivaluedMap responseHeaders = response.join().getHeaders(); + assertTrue(!responseHeaders.containsKey(HttpHeaders.CONTENT_ENCODING) + || !responseHeaders.get(HttpHeaders.CONTENT_ENCODING).toString().contains("application/json")); + assertTrue(responseHeaders.containsKey(HttpHeaders.CONTENT_TYPE) + && responseHeaders.get(HttpHeaders.CONTENT_TYPE).toString().contains("application/json")); + } + @EqualsAndHashCode static class User implements Serializable { private String name;