// Set expose_swoole_http_response to true
$router->get('/custom-swoole-response', function () use ($router) {
/**@var \Swoole\Http\Response $swooleResponse */
$swooleResponse = app('swoole-http-response');
$swooleResponse->end('swoole response');
$swooleResponse->isEnded = true; // isEnded must be set to true, indicating that the underlying Swoole\Http\Response object is directly used to process the response, so the response content is "swoole response" instead of "laravel response".
return 'laravel response';
});