javascript - Jquery and Slimframework - Status Request

one text

Solution:

The request and response headers are "immutable".

Instead of this:

$response->withStatus(503);

return $response;

Try this:

return $response->withStatus(503);

or

$response = $response->withStatus(503);

return $response;
// The headers are immutbale
$response = $response->withStatus(201)
    ->withHeader('Content-Type', 'text/plain');

// The body is not immutable
$response->getBody()->write('Done');

return $response;

Source