{"action":"created","issue":{"url":"https://api.github.com/repos/fortunejs/fortune-http/issues/11","repository_url":"https://api.github.com/repos/fortunejs/fortune-http","labels_url":"https://api.github.com/repos/fortunejs/fortune-http/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/fortunejs/fortune-http/issues/11/comments","events_url":"https://api.github.com/repos/fortunejs/fortune-http/issues/11/events","html_url":"https://github.com/fortunejs/fortune-http/issues/11","id":301196371,"number":11,"title":"Support for Koa","user":{"login":"cooperka","id":2047062,"avatar_url":"https://avatars2.githubusercontent.com/u/2047062?v=4","gravatar_id":"","url":"https://api.github.com/users/cooperka","html_url":"https://github.com/cooperka","followers_url":"https://api.github.com/users/cooperka/followers","following_url":"https://api.github.com/users/cooperka/following{/other_user}","gists_url":"https://api.github.com/users/cooperka/gists{/gist_id}","starred_url":"https://api.github.com/users/cooperka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cooperka/subscriptions","organizations_url":"https://api.github.com/users/cooperka/orgs","repos_url":"https://api.github.com/users/cooperka/repos","events_url":"https://api.github.com/users/cooperka/events{/privacy}","received_events_url":"https://api.github.com/users/cooperka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-28T21:49:29Z","updated_at":"2018-03-01T01:41:57Z","closed_at":null,"author_association":"NONE","body":"It seems that Fortune HTTP relies on several low-level methods such as `response.writeHead`.\r\n\r\n[Koa](http://koajs.com/), a web framework designed by the team behind [Express](http://expressjs.com/), provides access to Node's `response` object but [explicitly states](https://github.com/koajs/koa/blob/master/docs/api/context.md#api):\r\n\r\n> Bypassing Koa's response handling is **not supported**. Avoid using the following node properties:\r\n>\r\n> - res.statusCode\r\n> - res.writeHead()\r\n> - res.write()\r\n> - res.end()\r\n\r\nIndeed, trying to pass `ctx.req` and `ctx.res` to the `fortuneHttp()` listener results in errors:\r\n\r\n```\r\nRangeError: Invalid status code: null\r\n```\r\n\r\nand\r\n\r\n```\r\nError: Can't remove headers after they are sent\r\n```\r\n\r\nIs there any planned support for Koa? It's an awesome framework that would be great to be able to use. For now, I'll use Express instead.\r\n\r\nThank you for any clarity you can provide!"},"comment":{"url":"https://api.github.com/repos/fortunejs/fortune-http/issues/comments/369445843","html_url":"https://github.com/fortunejs/fortune-http/issues/11#issuecomment-369445843","issue_url":"https://api.github.com/repos/fortunejs/fortune-http/issues/11","id":369445843,"user":{"login":"daliwali","id":1175095,"avatar_url":"https://avatars0.githubusercontent.com/u/1175095?v=4","gravatar_id":"","url":"https://api.github.com/users/daliwali","html_url":"https://github.com/daliwali","followers_url":"https://api.github.com/users/daliwali/followers","following_url":"https://api.github.com/users/daliwali/following{/other_user}","gists_url":"https://api.github.com/users/daliwali/gists{/gist_id}","starred_url":"https://api.github.com/users/daliwali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daliwali/subscriptions","organizations_url":"https://api.github.com/users/daliwali/orgs","repos_url":"https://api.github.com/users/daliwali/repos","events_url":"https://api.github.com/users/daliwali/events{/privacy}","received_events_url":"https://api.github.com/users/daliwali/received_events","type":"User","site_admin":false},"created_at":"2018-03-01T01:41:57Z","updated_at":"2018-03-01T01:41:57Z","author_association":"OWNER","body":"I'm not sure how to best handle this since I have never used Koa, and Express seems to be far more popular, API compatibility may be a reason for that.\r\n\r\nIt sounds like a big no-no, because `fortune-http` does all of the things listed under \"avoid\"."}}
{"actor":{"display_login":"daliwali"}}