getBody()->write(json_encode($data)); return $response ->withHeader('Content-Type', 'application/json') ->withStatus(201); } public function withRedirect(Response $response, string $uri): Response { return $response ->withHeader('Location', $uri) ->withStatus(303); } }