Steps to replicate the issue (include links if applicable):
First, make a simple REST API request without an explicit Accept header (curl will send Accept: */* by default):
curl -A T412610 -i -d wikitext=test https://en.wikipedia.org/w/rest.php/v1/transform/wikitext/to/lint
Then, make the same request with an Accept: application/json header (which adds the same Accept header, along with a different Content-Type for the request body):
curl -A T412610 -i -d wikitext=test -H 'Accept: application/json' https://en.wikipedia.org/w/rest.php/v1/transform/wikitext/to/lint
You can also get the same result with curl’s --json option:
curl -A T412610 -i --json='{"wikitext": "test"}' https://en.wikipedia.org/w/rest.php/v1/transform/wikitext/to/lint
What happens?:
While the first request correctly returns JSON –
HTTP/2 200 content-type: application/json snip: many other headers []
– the second request returns an error:
HTTP/2 406 content-type: application/json snip: many other headers {"errorKey":"rest-unsupported-target-format","messageTranslations":{"en":"The requested target format is not supported."},"httpCode":406,"httpReason":"Not Acceptable"}
What should have happened instead?:
Both requests should return the same response, given that Accept: application/json asks for the same Content-Type that the API returns by default anyways.
Other information (browser name/version, screenshots, etc.):
I have not yet tested if other REST API endpoints are affected.