Skip to content

Handling Accept with both Consumes/Produces and HeaderParam annotations in JAX-RS contract #890

@bwangfdu

Description

@bwangfdu

I am facing the API of JAX-RS 2.0 contract with this definition:

@GET
    @Path("/orders/{externalOrderId}")
    @Produces({ "application/vnd.mycompany.application.order.v1+json", "application/vnd.mycompany.application.order+json", "application/vnd.mycompany.application.order.v2+json" })
    @ApiOperation(value = "Orders_GetOrderDetail", tags={  })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "OK", response = Order.class),
        @ApiResponse(code = 400, message = "Bad request", response = BadRequestResponseModel.class),
        @ApiResponse(code = 404, message = "Not Found", response = NotFoundResponseModel.class),
        @ApiResponse(code = 412, message = "Precondition Failed", response = PreconditionFailedModel.class),
        @ApiResponse(code = 500, message = "Internal Server Error", response = InternalErrorResponseModel.class) })
    public Order ordersGetOrderDetail(@PathParam("externalOrderId") String externalOrderId, @HeaderParam("Accept") String accept, @HeaderParam("Authorization") String authorization);

This is a design for supporting multiple data model and choose reply data model by the Accept header. But when I using OpenFeign 10.0.1, it put all the Produces and Accept into accept parameter into header.
We suppose to send only the header value in the parameter in this scenario.

And another issue is the @Conumes, when there are multiple values, it send all in Content-Type header. I think that may not make sense to have a body with multiple types.

I am not sure whether this is a mismatching of JAX-RS 2.0 definition or whatever.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected or incorrect behaviorregressionBugs and issues related to unintended breaking changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions