diff --git a/tests/Servers/Workerman.php b/tests/Servers/Workerman.php index 5284d36..2d3be94 100644 --- a/tests/Servers/Workerman.php +++ b/tests/Servers/Workerman.php @@ -57,10 +57,10 @@ function cookies(Request $request): string { if ($request->get() === []) { - return new Response(body: json_encode($request->cookie())); + return encode($request->cookie()); } - $response = new Response(); + $response = new Response(headers: ['Content-Type' => 'application/json']); if ($set = $request->get('set')) { foreach ($set as $name => $value) { $response->cookie($name, $value); @@ -73,10 +73,12 @@ function cookies(Request $request): string foreach ($delete as $name) { if ($request->cookie($name)) { //unset($_COOKIE[$name]); + $cookies = $request->cookie(); + unset($cookies[$name]); $response->cookie($name, '', -1); } } - return $response->withBody(json_encode($request->cookie())); + return $response->withBody(json_encode($cookies)); } }