Setting a status code?

So as a Response.setStatus(400) style method omitted on purpose or do I have to do this:

$newResponse = $response->withHeader(‘Content-type’, ‘application/json’);
$newResponse = $newResponse->withStatus(‘Content-type’, ‘application/json’);

just to get the right combination of headers and status for my response?

You can use the fluid interface:

return $response->withStatus(400)
                ->withHeader('Content-type', 'application/json');

if you’re returning JSON data, you can also use withJson():

$data['error'] = 'Something is wrong';
return $response->withJson($data, 400);

Ok, I’ll give that a try. Thanks!