Skip to content
Snippets Groups Projects

Issue #3398849: DELETE request on REST resource leads to null format given

@@ -102,6 +102,17 @@ public function getResponseFormat(RouteMatchInterface $route_match, Request $req
$requested_format = $request->getRequestFormat();
$content_type_format = $request->getContentType();
// Workaround for if there is no formats for a DELETE call:
// make the response formats match the format of the request
if ($request->getMethod() === 'DELETE') {
if (empty($acceptable_request_formats)) {
$acceptable_request_formats = [$requested_format];
}
if (empty($acceptable_formats)) {
$acceptable_formats = [$requested_format];
}
}
// If an acceptable response format is requested, then use that. Otherwise,
// including and particularly when the client forgot to specify a response
// format, then use heuristics to select the format that is most likely
Loading