0

I have this @PostMapping on my controller:

@PostMapping(value = Endpoints.PERMANENT, produces = MediaType.APPLICATION_JSON_VALUE)

I want to add versioning to my API so I updated it to accept the version in the Accept header:

@PostMapping(value = Endpoints.PERMANENT, produces = {"application/vnd.myapp.v1+json"})

If I now send a POST to that endpoint and include application/vnd.myapp.v1+json in the Acccept header the request is successful. If I change the value in my Accept header to application/vnd.pricegenerator.v2+json I get this(which is as expected):

{
    "statusMessage": "Not Acceptable"
}

If however, I send nothing in my Accept header the request still succeeds. Why is this and how can I resolve it?

runnerpaul
  • 5,942
  • 8
  • 49
  • 118

0 Answers0