Skip to content

Commit

Permalink
Fix workerman tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joanhey committed Feb 25, 2024
1 parent dafe135 commit 501176e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/Servers/Workerman.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
}
}

0 comments on commit 501176e

Please sign in to comment.