REST API returning 406 error when "accept: application/json" header included in request
See original GitHub issueI am running the Apicurio schema registry in Docker with the following configuration:
version: '3.8'
services:
...
schema-registry:
image: apicurio/apicurio-registry-kafka:1.3.1.Final
container_name: schema-registry
networks:
- kafka
depends_on:
- zookeeper
- kafka
ports:
- '8081:8081'
- '9000'
environment:
QUARKUS_PROFILE: prod
KAFKA_BOOTSTRAP_SERVERS: "kafka:29092"
HTTP_PORT: '8081'
APPLICATION_ID: schema-registry
APPLICATION_SERVER_HOST: schema-registry
APPLICATION_SERVER_PORT: '9000'
When I make a GET request without an “Accept” request header, or with “accept: application/vnd.schemaregistry.v1+json”, everything works fine:
$ curl --silent -X GET http://localhost:8081/api/ccompat/schemas/types
["JSON","PROTOBUF","AVRO"]
$ curl --silent -X GET http://localhost:8081/api/ccompat/schemas/types -H "accept: application/vnd.schemaregistry.v1+json"
["JSON","PROTOBUF","AVRO"]
However, when I use “accept: application/json”, which should also work, I get a 406 error:
$ curl --silent -X GET http://localhost:8081/api/ccompat/schemas/types -H "accept: application/json"
{"message":"RESTEASY003635: No match for accept header","error_code":406}
This same issue means that I cannot use AKHQ as a GUI for the Apicurio schema registry - see this GitHub issue for some background. I think the issue lies with Apicurio rather than AKHQ because AKHQ works just fine when using the Confluent schema registry.
Hopefully this should be a relatively trivial issue to fix, but it would certainly be nice if the Apicurio schema registry accepted all the same content types as the Confluent implementation (see here) and also worked nicely with AKHQ.
Update:
I’ve attached a screenshot of the error in AKHQ below:
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Hi @EricWittmann we’re not supporting all the accept headers that confluent does, this has been fixed here.
Thanks for the report. @carlesarnal I assume this is an easy fix, but could you dig into it and see what you can find?