Commit d8cf1783 authored by catch's avatar catch
Browse files

Issue #2558883 by jhedstrom: Improve DX of formats that are requested but not found

parent 6a10e562
......@@ -34,7 +34,7 @@ public function onViewDetect406(GetResponseForControllerResultEvent $event) {
// not HTML though we can also assume that the requested format is invalid
// so we provide a 406 response.
if (is_array($result) && $request->getRequestFormat() !== 'html') {
throw new NotAcceptableHttpException('Not acceptable');
throw new NotAcceptableHttpException('Not acceptable format: ' . $request->getRequestFormat());
}
}
......
......@@ -94,7 +94,7 @@ public function testRead() {
// application/hal+json, so it returns a 406.
$this->assertResponse('406', 'HTTP response code is 406 when the resource does not define formats, because it falls back to the canonical, non-REST route.');
$this->assertEqual($response, Json::encode([
'message' => 'Not acceptable',
'message' => 'Not acceptable format: hal_json',
]));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment