{"action":"closed","issue":{"url":"https://api.github.com/repos/swoft-cloud/swoft/issues/930","repository_url":"https://api.github.com/repos/swoft-cloud/swoft","labels_url":"https://api.github.com/repos/swoft-cloud/swoft/issues/930/labels{/name}","comments_url":"https://api.github.com/repos/swoft-cloud/swoft/issues/930/comments","events_url":"https://api.github.com/repos/swoft-cloud/swoft/issues/930/events","html_url":"https://github.com/swoft-cloud/swoft/issues/930","id":486909974,"node_id":"MDU6SXNzdWU0ODY5MDk5NzQ=","number":930,"title":"如何在AfterRequestListener里获取到response对象","user":{"login":"ChangeChe","id":14069126,"node_id":"MDQ6VXNlcjE0MDY5MTI2","avatar_url":"https://avatars3.githubusercontent.com/u/14069126?v=4","gravatar_id":"","url":"https://api.github.com/users/ChangeChe","html_url":"https://github.com/ChangeChe","followers_url":"https://api.github.com/users/ChangeChe/followers","following_url":"https://api.github.com/users/ChangeChe/following{/other_user}","gists_url":"https://api.github.com/users/ChangeChe/gists{/gist_id}","starred_url":"https://api.github.com/users/ChangeChe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChangeChe/subscriptions","organizations_url":"https://api.github.com/users/ChangeChe/orgs","repos_url":"https://api.github.com/users/ChangeChe/repos","events_url":"https://api.github.com/users/ChangeChe/events{/privacy}","received_events_url":"https://api.github.com/users/ChangeChe/received_events","type":"User","site_admin":false},"labels":[{"id":589924925,"node_id":"MDU6TGFiZWw1ODk5MjQ5MjU=","url":"https://api.github.com/repos/swoft-cloud/swoft/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-08-29T11:48:43Z","updated_at":"2019-08-30T07:59:45Z","closed_at":"2019-08-30T07:59:45Z","author_association":"NONE","body":"| Q                   | A\r\n| ------------------- | -----\r\n| Bug report?         | no\r\n| Feature request?    | yes\r\n| Swoft version       | 2.0.5\r\n| Swoole version      | 4.4.3\r\n| PHP version         | 7.2.16\r\n| Runtime environment | Docker etc.\r\n\r\n**Details**\r\n\r\n查看swoft包里提供的AfterRequestListener，response可通过`$event->getParam(0);`获得\r\n```\r\n/** @var Response $response */\r\n$response = $event->getParam(0);\r\n```\r\n但在实际中，`$event->getParam(0);`获取到的是`1`\r\n使用\r\n```\r\nContext::mustGet()->getResponse();\r\n```\r\n会提示coID丢失。\r\n要实现的功能是：记录每次请求的入参与出参以及response的状态码，在状态码=200的情况下，使用后置中间件可以实现这样的功能，但是其他状态码就不会走后置中间件了。\r\n问题：\r\n如何在AfterRequestListener里获取的Response"}}
{"actor":{"display_login":"ChangeChe"}}