From 58ddeea3d93b0f786d9db375d0642bf76e651fbe Mon Sep 17 00:00:00 2001 From: Rafael Neris <72398144+rafael-neris@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:06:51 -0300 Subject: [PATCH] Incluindo Header com Location (#9) --- app/Controller/PersonController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controller/PersonController.php b/app/Controller/PersonController.php index 36e90f4e..d87e6e67 100644 --- a/app/Controller/PersonController.php +++ b/app/Controller/PersonController.php @@ -44,7 +44,7 @@ public function create(PersonRequest $request, ResponseInterface $response): Mes $this->cache->set($person['nick'], '.'); $this->cache->set($person['id'], json_encode($person)); - return $response->json($person)->withStatus(201); + return $response->json($person)->withStatus(201)->withHeader('Location', "/pessoas/{$person['id']}"); } public function show(RequestInterface $request, ResponseInterface $response, string $id): MessageResponseInterface