mark
mark copied to clipboard
BC Callback: request, response, ...args
Breaking changes
Closes #13
Useful for headers, status code and other purposes.
$response is an instance of \Workerman\Protocols\Http\Response
Example of JSON endpoint:
$api->get('/json', function ($request, $response) {
return $response->withHeader('Content-Type', 'application/json')
->withBody(json_encode(['a' => 1, 'b' => 2]));
});