Drupal\Core\Routing\RequestFormatRouteFilter can throw Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException, and it does it for html format also, but it shouldn't. So we should add check for format and throw 406 for non html formats only.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kalistos created an issue. See original summary.

kalistos’s picture

Status: Active » Needs review
FileSize
1.02 KB

Status: Needs review » Needs work

The last submitted patch, 2: drupal-format_filter_fix-2839622-2.patch, failed testing.

aditya.n’s picture

@kalistos, since most of your patch fails said 'Failed asserting that 405 is identical to 406' hence just for that I am rolling a patch which will throw a 405 status instead of 406.

P.S I am not sure if it is safe to use other exception handler.

Status: Needs review » Needs work

The last submitted patch, 4: drupal-core-html-exception-throw-2839622-4-8.2.x-dev.patch, failed testing.

Wim Leers’s picture

Component: rest.module » request processing system
Status: Needs work » Closed (works as designed)

Why should this not throw a 406 for the HTML format? AFAICT this is entirely correct. Feel free to reopen, but then please at least include a justification/explanation, and even better would be a test showing why it should work differently.