Skip to content

Content Negotiation Problem with Jackson XML #2743

Closed
@JEDIBC

Description

Hi,

The content negociation depending on the accept http header doesn't work (or there's some configuration not described in the doc)

Steps to Reproduce

  1. Create a 1.3 project
  2. Add https://github.com/micronaut-projects/micronaut-jackson-xml dependency to be able to bind & serialise XML
  3. Create a controller with @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) and @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  4. call your controller with the accept: application/xml header

Expected Behaviour

The result should be in XML.

Actual Behaviour

The result is still in JSON

I must say that if you only need XML output and add @Produces(MediaType.APPLICATION_XML) in your controller, the ouput is correctly serialized in XML.

Environment Information

  • Operating System: Ubuntu 18.04
  • Micronaut Version: 1.3.0
  • JDK Version: 11.0.5

Thanks

Regards,

Bruno

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions