{"action":"created","comment":{"url":"https://api.github.com/repos/wikimedia/restbase/pulls/comments/50930067","id":50930067,"diff_hunk":"@@ -0,0 +1,71 @@\n+'use strict';\n+\n+var stream = require('stream');\n+\n+function hello(restbase, req) {\n+    var body = new stream.PassThrough();\n+    body.end('hello');\n+    return {\n+        status: 200,\n+        headers: {\n+            'content-type': 'text/html',\n+        },\n+        body: body\n+    };\n+}\n+\n+function buffer(restbase, req) {\n+    var body = new stream.PassThrough();\n+    body.end(new Buffer('hello'));\n+    return {\n+        status: 200,\n+        headers: {\n+            'content-type': 'text/html',\n+        },\n+        body: body\n+    };\n+}\n+\n+function chunks(restbase, req) {\n+    var body = new stream.PassThrough();\n+    for (var i = 0; i < 100; i++) {\n+        body.write(i.toString());\n+    }\n+    body.end();\n+    return {\n+        status: 200,\n+        headers: {\n+            'content-type': 'text/html',\n+        },\n+        body: body\n+    };\n+}\n+\n+module.exports = function(options) {\n+    return {\n+        spec: {\n+            paths: {\n+                '/hello': {\n+                    get: {\n+                        operationId: 'hello'\n+                    }\n+                },\n+                '/buffer': {\n+                    get: {\n+                        operationId: 'buffer'\n+                    }\n+                },\n+                '/chunks': {\n+                    get: {\n+                        operationId: 'chunks'\n+                    }\n+                }\n+            }\n+        },\n+        operations: {\n+            hello: hello,\n+            buffer: buffer,\n+            chunks: chunks,\n+        }\n+    };\n+};","path":"test/framework/streaming/stream_module.js","position":76,"original_position":71,"commit_id":"e782ae25a70883780b5c00827aca1925157469e7","original_commit_id":"e51371e98515fd2589794835b0c0002d7e7c35a4","user":{"login":"gwicke","id":1225898,"avatar_url":"https://avatars.githubusercontent.com/u/1225898?v=3","gravatar_id":"","url":"https://api.github.com/users/gwicke","html_url":"https://github.com/gwicke","followers_url":"https://api.github.com/users/gwicke/followers","following_url":"https://api.github.com/users/gwicke/following{/other_user}","gists_url":"https://api.github.com/users/gwicke/gists{/gist_id}","starred_url":"https://api.github.com/users/gwicke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwicke/subscriptions","organizations_url":"https://api.github.com/users/gwicke/orgs","repos_url":"https://api.github.com/users/gwicke/repos","events_url":"https://api.github.com/users/gwicke/events{/privacy}","received_events_url":"https://api.github.com/users/gwicke/received_events","type":"User","site_admin":false},"body":"Good idea. I made the buffer test async.","created_at":"2016-01-27T01:27:00Z","updated_at":"2016-01-27T01:27:00Z","html_url":"https://github.com/wikimedia/restbase/pull/479#discussion_r50930067","pull_request_url":"https://api.github.com/repos/wikimedia/restbase/pulls/479","_links":{"self":{"href":"https://api.github.com/repos/wikimedia/restbase/pulls/comments/50930067"},"html":{"href":"https://github.com/wikimedia/restbase/pull/479#discussion_r50930067"},"pull_request":{"href":"https://api.github.com/repos/wikimedia/restbase/pulls/479"}}},"pull_request":{"url":"https://api.github.com/repos/wikimedia/restbase/pulls/479","id":57154047,"html_url":"https://github.com/wikimedia/restbase/pull/479","diff_url":"https://github.com/wikimedia/restbase/pull/479.diff","patch_url":"https://github.com/wikimedia/restbase/pull/479.patch","issue_url":"https://api.github.com/repos/wikimedia/restbase/issues/479","number":479,"state":"open","locked":false,"title":"Support streaming responses","user":{"login":"gwicke","id":1225898,"avatar_url":"https://avatars.githubusercontent.com/u/1225898?v=3","gravatar_id":"","url":"https://api.github.com/users/gwicke","html_url":"https://github.com/gwicke","followers_url":"https://api.github.com/users/gwicke/followers","following_url":"https://api.github.com/users/gwicke/following{/other_user}","gists_url":"https://api.github.com/users/gwicke/gists{/gist_id}","starred_url":"https://api.github.com/users/gwicke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwicke/subscriptions","organizations_url":"https://api.github.com/users/gwicke/orgs","repos_url":"https://api.github.com/users/gwicke/repos","events_url":"https://api.github.com/users/gwicke/events{/privacy}","received_events_url":"https://api.github.com/users/gwicke/received_events","type":"User","site_admin":false},"body":"Use cases like chunked storage and proxied requests can be sped up by\r\nstreaming the response as it comes in.\r\n\r\nThis patch adds support for returning a `Readable` stream from handlers, and\r\nis targeted at chunked storage buckets. In the longer term, we probably want\r\nto switch to the richer\r\n[ReadableStream](https://streams.spec.whatwg.org/#rs-model) abstraction, but\r\nnode implementations for that are still lacking, and this gets us started with\r\nNode's native streams.\r\n\r\nTask: https://phabricator.wikimedia.org/T124696","created_at":"2016-01-26T00:38:37Z","updated_at":"2016-01-27T01:27:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e84b953d43d5a62eec12662fb0d1e4fc921a4680","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wikimedia/restbase/pulls/479/commits","review_comments_url":"https://api.github.com/repos/wikimedia/restbase/pulls/479/comments","review_comment_url":"https://api.github.com/repos/wikimedia/restbase/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wikimedia/restbase/issues/479/comments","statuses_url":"https://api.github.com/repos/wikimedia/restbase/statuses/e782ae25a70883780b5c00827aca1925157469e7","head":{"label":"gwicke:stream_response_support","ref":"stream_response_support","sha":"e782ae25a70883780b5c00827aca1925157469e7","user":{"login":"gwicke","id":1225898,"avatar_url":"https://avatars.githubusercontent.com/u/1225898?v=3","gravatar_id":"","url":"https://api.github.com/users/gwicke","html_url":"https://github.com/gwicke","followers_url":"https://api.github.com/users/gwicke/followers","following_url":"https://api.github.com/users/gwicke/following{/other_user}","gists_url":"https://api.github.com/users/gwicke/gists{/gist_id}","starred_url":"https://api.github.com/users/gwicke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwicke/subscriptions","organizations_url":"https://api.github.com/users/gwicke/orgs","repos_url":"https://api.github.com/users/gwicke/repos","events_url":"https://api.github.com/users/gwicke/events{/privacy}","received_events_url":"https://api.github.com/users/gwicke/received_events","type":"User","site_admin":false},"repo":{"id":26503318,"name":"restbase","full_name":"gwicke/restbase","owner":{"login":"gwicke","id":1225898,"avatar_url":"https://avatars.githubusercontent.com/u/1225898?v=3","gravatar_id":"","url":"https://api.github.com/users/gwicke","html_url":"https://github.com/gwicke","followers_url":"https://api.github.com/users/gwicke/followers","following_url":"https://api.github.com/users/gwicke/following{/other_user}","gists_url":"https://api.github.com/users/gwicke/gists{/gist_id}","starred_url":"https://api.github.com/users/gwicke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwicke/subscriptions","organizations_url":"https://api.github.com/users/gwicke/orgs","repos_url":"https://api.github.com/users/gwicke/repos","events_url":"https://api.github.com/users/gwicke/events{/privacy}","received_events_url":"https://api.github.com/users/gwicke/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gwicke/restbase","description":"Distributed storage with REST API & dispatcher for backend services","fork":true,"url":"https://api.github.com/repos/gwicke/restbase","forks_url":"https://api.github.com/repos/gwicke/restbase/forks","keys_url":"https://api.github.com/repos/gwicke/restbase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gwicke/restbase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gwicke/restbase/teams","hooks_url":"https://api.github.com/repos/gwicke/restbase/hooks","issue_events_url":"https://api.github.com/repos/gwicke/restbase/issues/events{/number}","events_url":"https://api.github.com/repos/gwicke/restbase/events","assignees_url":"https://api.github.com/repos/gwicke/restbase/assignees{/user}","branches_url":"https://api.github.com/repos/gwicke/restbase/branches{/branch}","tags_url":"https://api.github.com/repos/gwicke/restbase/tags","blobs_url":"https://api.github.com/repos/gwicke/restbase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gwicke/restbase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gwicke/restbase/git/refs{/sha}","trees_url":"https://api.github.com/repos/gwicke/restbase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gwicke/restbase/statuses/{sha}","languages_url":"https://api.github.com/repos/gwicke/restbase/languages","stargazers_url":"https://api.github.com/repos/gwicke/restbase/stargazers","contributors_url":"https://api.github.com/repos/gwicke/restbase/contributors","subscribers_url":"https://api.github.com/repos/gwicke/restbase/subscribers","subscription_url":"https://api.github.com/repos/gwicke/restbase/subscription","commits_url":"https://api.github.com/repos/gwicke/restbase/commits{/sha}","git_commits_url":"https://api.github.com/repos/gwicke/restbase/git/commits{/sha}","comments_url":"https://api.github.com/repos/gwicke/restbase/comments{/number}","issue_comment_url":"https://api.github.com/repos/gwicke/restbase/issues/comments{/number}","contents_url":"https://api.github.com/repos/gwicke/restbase/contents/{+path}","compare_url":"https://api.github.com/repos/gwicke/restbase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gwicke/restbase/merges","archive_url":"https://api.github.com/repos/gwicke/restbase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gwicke/restbase/downloads","issues_url":"https://api.github.com/repos/gwicke/restbase/issues{/number}","pulls_url":"https://api.github.com/repos/gwicke/restbase/pulls{/number}","milestones_url":"https://api.github.com/repos/gwicke/restbase/milestones{/number}","notifications_url":"https://api.github.com/repos/gwicke/restbase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gwicke/restbase/labels{/name}","releases_url":"https://api.github.com/repos/gwicke/restbase/releases{/id}","deployments_url":"https://api.github.com/repos/gwicke/restbase/deployments","created_at":"2014-11-11T20:37:55Z","updated_at":"2015-07-16T13:04:30Z","pushed_at":"2016-01-27T01:25:19Z","git_url":"git://github.com/gwicke/restbase.git","ssh_url":"git@github.com:gwicke/restbase.git","clone_url":"https://github.com/gwicke/restbase.git","svn_url":"https://github.com/gwicke/restbase","homepage":"","size":2135,"stargazers_count":12,"watchers_count":12,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":0,"forks":3,"open_issues":0,"watchers":12,"default_branch":"master"}},"base":{"label":"wikimedia:master","ref":"master","sha":"8c4fe74de8dac252f7b0f00b54e482b666b80dcd","user":{"login":"wikimedia","id":56668,"avatar_url":"https://avatars.githubusercontent.com/u/56668?v=3","gravatar_id":"","url":"https://api.github.com/users/wikimedia","html_url":"https://github.com/wikimedia","followers_url":"https://api.github.com/users/wikimedia/followers","following_url":"https://api.github.com/users/wikimedia/following{/other_user}","gists_url":"https://api.github.com/users/wikimedia/gists{/gist_id}","starred_url":"https://api.github.com/users/wikimedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wikimedia/subscriptions","organizations_url":"https://api.github.com/users/wikimedia/orgs","repos_url":"https://api.github.com/users/wikimedia/repos","events_url":"https://api.github.com/users/wikimedia/events{/privacy}","received_events_url":"https://api.github.com/users/wikimedia/received_events","type":"Organization","site_admin":false},"repo":{"id":19002414,"name":"restbase","full_name":"wikimedia/restbase","owner":{"login":"wikimedia","id":56668,"avatar_url":"https://avatars.githubusercontent.com/u/56668?v=3","gravatar_id":"","url":"https://api.github.com/users/wikimedia","html_url":"https://github.com/wikimedia","followers_url":"https://api.github.com/users/wikimedia/followers","following_url":"https://api.github.com/users/wikimedia/following{/other_user}","gists_url":"https://api.github.com/users/wikimedia/gists{/gist_id}","starred_url":"https://api.github.com/users/wikimedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wikimedia/subscriptions","organizations_url":"https://api.github.com/users/wikimedia/orgs","repos_url":"https://api.github.com/users/wikimedia/repos","events_url":"https://api.github.com/users/wikimedia/events{/privacy}","received_events_url":"https://api.github.com/users/wikimedia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wikimedia/restbase","description":"Distributed storage with REST API & dispatcher for backend services","fork":false,"url":"https://api.github.com/repos/wikimedia/restbase","forks_url":"https://api.github.com/repos/wikimedia/restbase/forks","keys_url":"https://api.github.com/repos/wikimedia/restbase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wikimedia/restbase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wikimedia/restbase/teams","hooks_url":"https://api.github.com/repos/wikimedia/restbase/hooks","issue_events_url":"https://api.github.com/repos/wikimedia/restbase/issues/events{/number}","events_url":"https://api.github.com/repos/wikimedia/restbase/events","assignees_url":"https://api.github.com/repos/wikimedia/restbase/assignees{/user}","branches_url":"https://api.github.com/repos/wikimedia/restbase/branches{/branch}","tags_url":"https://api.github.com/repos/wikimedia/restbase/tags","blobs_url":"https://api.github.com/repos/wikimedia/restbase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wikimedia/restbase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wikimedia/restbase/git/refs{/sha}","trees_url":"https://api.github.com/repos/wikimedia/restbase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wikimedia/restbase/statuses/{sha}","languages_url":"https://api.github.com/repos/wikimedia/restbase/languages","stargazers_url":"https://api.github.com/repos/wikimedia/restbase/stargazers","contributors_url":"https://api.github.com/repos/wikimedia/restbase/contributors","subscribers_url":"https://api.github.com/repos/wikimedia/restbase/subscribers","subscription_url":"https://api.github.com/repos/wikimedia/restbase/subscription","commits_url":"https://api.github.com/repos/wikimedia/restbase/commits{/sha}","git_commits_url":"https://api.github.com/repos/wikimedia/restbase/git/commits{/sha}","comments_url":"https://api.github.com/repos/wikimedia/restbase/comments{/number}","issue_comment_url":"https://api.github.com/repos/wikimedia/restbase/issues/comments{/number}","contents_url":"https://api.github.com/repos/wikimedia/restbase/contents/{+path}","compare_url":"https://api.github.com/repos/wikimedia/restbase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wikimedia/restbase/merges","archive_url":"https://api.github.com/repos/wikimedia/restbase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wikimedia/restbase/downloads","issues_url":"https://api.github.com/repos/wikimedia/restbase/issues{/number}","pulls_url":"https://api.github.com/repos/wikimedia/restbase/pulls{/number}","milestones_url":"https://api.github.com/repos/wikimedia/restbase/milestones{/number}","notifications_url":"https://api.github.com/repos/wikimedia/restbase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wikimedia/restbase/labels{/name}","releases_url":"https://api.github.com/repos/wikimedia/restbase/releases{/id}","deployments_url":"https://api.github.com/repos/wikimedia/restbase/deployments","created_at":"2014-04-21T18:35:00Z","updated_at":"2016-01-15T00:50:51Z","pushed_at":"2016-01-27T01:25:20Z","git_url":"git://github.com/wikimedia/restbase.git","ssh_url":"git@github.com:wikimedia/restbase.git","clone_url":"https://github.com/wikimedia/restbase.git","svn_url":"https://github.com/wikimedia/restbase","homepage":"https://www.mediawiki.org/wiki/RESTBase","size":2536,"stargazers_count":39,"watchers_count":39,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":28,"mirror_url":null,"open_issues_count":5,"forks":28,"open_issues":5,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wikimedia/restbase/pulls/479"},"html":{"href":"https://github.com/wikimedia/restbase/pull/479"},"issue":{"href":"https://api.github.com/repos/wikimedia/restbase/issues/479"},"comments":{"href":"https://api.github.com/repos/wikimedia/restbase/issues/479/comments"},"review_comments":{"href":"https://api.github.com/repos/wikimedia/restbase/pulls/479/comments"},"review_comment":{"href":"https://api.github.com/repos/wikimedia/restbase/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wikimedia/restbase/pulls/479/commits"},"statuses":{"href":"https://api.github.com/repos/wikimedia/restbase/statuses/e782ae25a70883780b5c00827aca1925157469e7"}}}}