wiremock / wiremock-jaxrs

Automates configuration of Wiremock stubs from JAX-RS annotated resources.
Apache License 2.0
8 stars 1 forks source link

ACCEPT/CONTENT_TYPE headers are incorrectly derived from javax annotations #1

Closed bgergo93 closed 5 months ago

bgergo93 commented 1 year ago

The code incorrectly sets expectations on the ACCEPT header, based on the responseTypeList(Produces).. As per my understanding of the terminology, both Produces/Consumes are related to the content-type header, the only difference is, the first for the response and the latter is for the request.

ACCEPT - Defined by the client, what kind of response they want.

CONTENT-TYPE - Both HTTP request and response could have a content-type, which defines the media type of the payload (HTTP POST/PUT request’s body, or any HTTP response’s body).

@Produces - These are the content-types, that the server can provide, so it yields to HTTP response's content-type.

@Consumes - These are the content-types, that the server is able to handle, so it yields to HTTP request's content-type.

tomasbjerre commented 1 year ago

PR:s are welcome.

tomasbjerre commented 5 months ago

Here is a test case with combinations of produces and consumes: https://github.com/wiremock/wiremock-jaxrs/blob/master/src/test/java/se/bjurr/wiremock/test/testcases/ConsumesAndProducesIntergrationTest.java

Can you point at which one of them you think is incorrect? Or provide an annotated interface along with a mapping you think it should translate to.

I agree with your opinions here but I think the test case shows that it is implemented as you suggest. Closing this issue, but please open it again if I am not correct here.