This always returns 200 [Ok] despite the fact I set ->withStatus(400). Any advice on what I’ve screwed up here?
Thanks in advance!
// Get a single user by id
11 $app->get('/user', function (Request $request, Response $response) {
12 // Get the parameters
13 $params = $request->getQueryParams();
14 if (!isset($params['id']) || !is_numeric($params['id'])) {
15 $newResponse = $response;
16 $newResponse->withStatus(400)->write('Bad Request');
17 return $newResponse;
18 } ...