{"action":"created","comment":{"url":"https://api.github.com/repos/spacechop/spacechop/pulls/comments/211468784","pull_request_review_id":147893390,"id":211468784,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTQ2ODc4NA==","diff_hunk":"@@ -0,0 +1,79 @@\n+import fs from 'fs';\n+import path from 'path';\n+import HttpSource, { buildUri } from '..';\n+import createMockServer from '../../../test/utils/createMockServer';\n+import { Stream } from 'stream';\n+import toMatchImageSnapshot from '../../../test/utils/toMatchImageSnapshot';\n+\n+expect.extend({ toMatchImageSnapshot });\n+\n+describe('HTTP Source', () => {\n+  describe('buildUri', () => {\n+    const paths = [\n+      'http://spacechop.com/:image',\n+      'http://localhost:8080/:image',\n+    ];\n+\n+    const params = {\n+      image: 'test.jpg',\n+    };\n+\n+    const expected = [\n+      'http://spacechop.com/test.jpg',\n+      'http://localhost:8080/test.jpg',\n+    ];\n+\n+    for (let i in paths) {\n+      const path = paths[i];\n+      it(`should work with path: ${path}`, () => {\n+        expect(buildUri(path, params)).toBe(expected[i]);\n+      });\n+    }\n+  });\n+\n+  describe('config', () => {\n+    const config = { root: 'http://localhost:9000/:image' };\n+    const instance = new HttpSource(config);\n+    const listener = jest.fn();\n+    const handler = (req, res) => {\n+      const { image } = req.params;\n+      const filename = path.join(__dirname, '../../../test/assets', image);\n+      const exists = fs.existsSync(filename);\n+      listener(req.originalUrl);\n+      res.status(exists ? 200 : 404);\n+      if (exists && req.method === 'GET') {\n+        const stream = fs.createReadStream(filename);\n+        stream.pipe(res);\n+      } else {\n+        res.end();\n+      }\n+    };\n+    let server;\n+\n+    beforeAll(async() => {\n+      server = await createMockServer(9000, handler, '/:image');\n+    });\n+    afterAll(async () => {\n+      await server.close();\n+    });\n+\n+    it('should save config', () => {\n+      expect(instance.config).toEqual(\n+        expect.objectContaining(config),\n+      );\n+    });\n+\n+    it('should resolve exists', async () => {\n+      const result = await instance.exists({image: 'cat.jpg' });\n+      expect(listener).toHaveBeenCalledWith('/cat.jpg');\n+      expect(result).toBe(true);\n+    });\n+\n+    it('should resolve to stream', async () => {","path":"src/sources/http/__tests__/index.ts","position":72,"original_position":72,"commit_id":"e77017cc3e47bf439362392b9c89c5820dc03f17","original_commit_id":"e77017cc3e47bf439362392b9c89c5820dc03f17","user":{"login":"ericwenn","id":5495697,"node_id":"MDQ6VXNlcjU0OTU2OTc=","avatar_url":"https://avatars2.githubusercontent.com/u/5495697?v=4","gravatar_id":"","url":"https://api.github.com/users/ericwenn","html_url":"https://github.com/ericwenn","followers_url":"https://api.github.com/users/ericwenn/followers","following_url":"https://api.github.com/users/ericwenn/following{/other_user}","gists_url":"https://api.github.com/users/ericwenn/gists{/gist_id}","starred_url":"https://api.github.com/users/ericwenn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericwenn/subscriptions","organizations_url":"https://api.github.com/users/ericwenn/orgs","repos_url":"https://api.github.com/users/ericwenn/repos","events_url":"https://api.github.com/users/ericwenn/events{/privacy}","received_events_url":"https://api.github.com/users/ericwenn/received_events","type":"User","site_admin":false},"body":"proposed name: .stream should resolve to stream if image exists.","created_at":"2018-08-21T03:26:37Z","updated_at":"2018-08-21T03:27:02Z","html_url":"https://github.com/spacechop/spacechop/pull/7#discussion_r211468784","pull_request_url":"https://api.github.com/repos/spacechop/spacechop/pulls/7","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/spacechop/spacechop/pulls/comments/211468784"},"html":{"href":"https://github.com/spacechop/spacechop/pull/7#discussion_r211468784"},"pull_request":{"href":"https://api.github.com/repos/spacechop/spacechop/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/spacechop/spacechop/pulls/7","id":209687732,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5Njg3NzMy","html_url":"https://github.com/spacechop/spacechop/pull/7","diff_url":"https://github.com/spacechop/spacechop/pull/7.diff","patch_url":"https://github.com/spacechop/spacechop/pull/7.patch","issue_url":"https://api.github.com/repos/spacechop/spacechop/issues/7","number":7,"state":"open","locked":false,"title":"Fixed issue with port in path.","user":{"login":"timbrandin","id":1715834,"node_id":"MDQ6VXNlcjE3MTU4MzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1715834?v=4","gravatar_id":"","url":"https://api.github.com/users/timbrandin","html_url":"https://github.com/timbrandin","followers_url":"https://api.github.com/users/timbrandin/followers","following_url":"https://api.github.com/users/timbrandin/following{/other_user}","gists_url":"https://api.github.com/users/timbrandin/gists{/gist_id}","starred_url":"https://api.github.com/users/timbrandin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timbrandin/subscriptions","organizations_url":"https://api.github.com/users/timbrandin/orgs","repos_url":"https://api.github.com/users/timbrandin/repos","events_url":"https://api.github.com/users/timbrandin/events{/privacy}","received_events_url":"https://api.github.com/users/timbrandin/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-21T01:53:30Z","updated_at":"2018-08-21T03:27:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29ede82ff1b1d06a00ee35e78dd9102827127371","assignee":{"login":"timbrandin","id":1715834,"node_id":"MDQ6VXNlcjE3MTU4MzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1715834?v=4","gravatar_id":"","url":"https://api.github.com/users/timbrandin","html_url":"https://github.com/timbrandin","followers_url":"https://api.github.com/users/timbrandin/followers","following_url":"https://api.github.com/users/timbrandin/following{/other_user}","gists_url":"https://api.github.com/users/timbrandin/gists{/gist_id}","starred_url":"https://api.github.com/users/timbrandin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timbrandin/subscriptions","organizations_url":"https://api.github.com/users/timbrandin/orgs","repos_url":"https://api.github.com/users/timbrandin/repos","events_url":"https://api.github.com/users/timbrandin/events{/privacy}","received_events_url":"https://api.github.com/users/timbrandin/received_events","type":"User","site_admin":false},"assignees":[{"login":"timbrandin","id":1715834,"node_id":"MDQ6VXNlcjE3MTU4MzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1715834?v=4","gravatar_id":"","url":"https://api.github.com/users/timbrandin","html_url":"https://github.com/timbrandin","followers_url":"https://api.github.com/users/timbrandin/followers","following_url":"https://api.github.com/users/timbrandin/following{/other_user}","gists_url":"https://api.github.com/users/timbrandin/gists{/gist_id}","starred_url":"https://api.github.com/users/timbrandin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timbrandin/subscriptions","organizations_url":"https://api.github.com/users/timbrandin/orgs","repos_url":"https://api.github.com/users/timbrandin/repos","events_url":"https://api.github.com/users/timbrandin/events{/privacy}","received_events_url":"https://api.github.com/users/timbrandin/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1028354614,"node_id":"MDU6TGFiZWwxMDI4MzU0NjE0","url":"https://api.github.com/repos/spacechop/spacechop/labels/bug","name":"bug","color":"d73a4a","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/spacechop/spacechop/pulls/7/commits","review_comments_url":"https://api.github.com/repos/spacechop/spacechop/pulls/7/comments","review_comment_url":"https://api.github.com/repos/spacechop/spacechop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spacechop/spacechop/issues/7/comments","statuses_url":"https://api.github.com/repos/spacechop/spacechop/statuses/e77017cc3e47bf439362392b9c89c5820dc03f17","head":{"label":"spacechop:fix-issue-with-port-in-http-root","ref":"fix-issue-with-port-in-http-root","sha":"e77017cc3e47bf439362392b9c89c5820dc03f17","user":{"login":"spacechop","id":38423853,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NDIzODUz","avatar_url":"https://avatars2.githubusercontent.com/u/38423853?v=4","gravatar_id":"","url":"https://api.github.com/users/spacechop","html_url":"https://github.com/spacechop","followers_url":"https://api.github.com/users/spacechop/followers","following_url":"https://api.github.com/users/spacechop/following{/other_user}","gists_url":"https://api.github.com/users/spacechop/gists{/gist_id}","starred_url":"https://api.github.com/users/spacechop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacechop/subscriptions","organizations_url":"https://api.github.com/users/spacechop/orgs","repos_url":"https://api.github.com/users/spacechop/repos","events_url":"https://api.github.com/users/spacechop/events{/privacy}","received_events_url":"https://api.github.com/users/spacechop/received_events","type":"Organization","site_admin":false},"repo":{"id":145254972,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUyNTQ5NzI=","name":"spacechop","full_name":"spacechop/spacechop","owner":{"login":"spacechop","id":38423853,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NDIzODUz","avatar_url":"https://avatars2.githubusercontent.com/u/38423853?v=4","gravatar_id":"","url":"https://api.github.com/users/spacechop","html_url":"https://github.com/spacechop","followers_url":"https://api.github.com/users/spacechop/followers","following_url":"https://api.github.com/users/spacechop/following{/other_user}","gists_url":"https://api.github.com/users/spacechop/gists{/gist_id}","starred_url":"https://api.github.com/users/spacechop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacechop/subscriptions","organizations_url":"https://api.github.com/users/spacechop/orgs","repos_url":"https://api.github.com/users/spacechop/repos","events_url":"https://api.github.com/users/spacechop/events{/privacy}","received_events_url":"https://api.github.com/users/spacechop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spacechop/spacechop","description":"Fast, simple, scalable HTTP service for high-level image processing with first-class Docker support","fork":false,"url":"https://api.github.com/repos/spacechop/spacechop","forks_url":"https://api.github.com/repos/spacechop/spacechop/forks","keys_url":"https://api.github.com/repos/spacechop/spacechop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spacechop/spacechop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spacechop/spacechop/teams","hooks_url":"https://api.github.com/repos/spacechop/spacechop/hooks","issue_events_url":"https://api.github.com/repos/spacechop/spacechop/issues/events{/number}","events_url":"https://api.github.com/repos/spacechop/spacechop/events","assignees_url":"https://api.github.com/repos/spacechop/spacechop/assignees{/user}","branches_url":"https://api.github.com/repos/spacechop/spacechop/branches{/branch}","tags_url":"https://api.github.com/repos/spacechop/spacechop/tags","blobs_url":"https://api.github.com/repos/spacechop/spacechop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spacechop/spacechop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spacechop/spacechop/git/refs{/sha}","trees_url":"https://api.github.com/repos/spacechop/spacechop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spacechop/spacechop/statuses/{sha}","languages_url":"https://api.github.com/repos/spacechop/spacechop/languages","stargazers_url":"https://api.github.com/repos/spacechop/spacechop/stargazers","contributors_url":"https://api.github.com/repos/spacechop/spacechop/contributors","subscribers_url":"https://api.github.com/repos/spacechop/spacechop/subscribers","subscription_url":"https://api.github.com/repos/spacechop/spacechop/subscription","commits_url":"https://api.github.com/repos/spacechop/spacechop/commits{/sha}","git_commits_url":"https://api.github.com/repos/spacechop/spacechop/git/commits{/sha}","comments_url":"https://api.github.com/repos/spacechop/spacechop/comments{/number}","issue_comment_url":"https://api.github.com/repos/spacechop/spacechop/issues/comments{/number}","contents_url":"https://api.github.com/repos/spacechop/spacechop/contents/{+path}","compare_url":"https://api.github.com/repos/spacechop/spacechop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spacechop/spacechop/merges","archive_url":"https://api.github.com/repos/spacechop/spacechop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spacechop/spacechop/downloads","issues_url":"https://api.github.com/repos/spacechop/spacechop/issues{/number}","pulls_url":"https://api.github.com/repos/spacechop/spacechop/pulls{/number}","milestones_url":"https://api.github.com/repos/spacechop/spacechop/milestones{/number}","notifications_url":"https://api.github.com/repos/spacechop/spacechop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spacechop/spacechop/labels{/name}","releases_url":"https://api.github.com/repos/spacechop/spacechop/releases{/id}","deployments_url":"https://api.github.com/repos/spacechop/spacechop/deployments","created_at":"2018-08-18T21:50:47Z","updated_at":"2018-08-21T03:09:52Z","pushed_at":"2018-08-21T03:11:55Z","git_url":"git://github.com/spacechop/spacechop.git","ssh_url":"git@github.com:spacechop/spacechop.git","clone_url":"https://github.com/spacechop/spacechop.git","svn_url":"https://github.com/spacechop/spacechop","homepage":"","size":7432,"stargazers_count":5,"watchers_count":5,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":5,"default_branch":"master"}},"base":{"label":"spacechop:master","ref":"master","sha":"2d03acfecf681eb9451c2ddee378be73ebf9c5bb","user":{"login":"spacechop","id":38423853,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NDIzODUz","avatar_url":"https://avatars2.githubusercontent.com/u/38423853?v=4","gravatar_id":"","url":"https://api.github.com/users/spacechop","html_url":"https://github.com/spacechop","followers_url":"https://api.github.com/users/spacechop/followers","following_url":"https://api.github.com/users/spacechop/following{/other_user}","gists_url":"https://api.github.com/users/spacechop/gists{/gist_id}","starred_url":"https://api.github.com/users/spacechop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacechop/subscriptions","organizations_url":"https://api.github.com/users/spacechop/orgs","repos_url":"https://api.github.com/users/spacechop/repos","events_url":"https://api.github.com/users/spacechop/events{/privacy}","received_events_url":"https://api.github.com/users/spacechop/received_events","type":"Organization","site_admin":false},"repo":{"id":145254972,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUyNTQ5NzI=","name":"spacechop","full_name":"spacechop/spacechop","owner":{"login":"spacechop","id":38423853,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NDIzODUz","avatar_url":"https://avatars2.githubusercontent.com/u/38423853?v=4","gravatar_id":"","url":"https://api.github.com/users/spacechop","html_url":"https://github.com/spacechop","followers_url":"https://api.github.com/users/spacechop/followers","following_url":"https://api.github.com/users/spacechop/following{/other_user}","gists_url":"https://api.github.com/users/spacechop/gists{/gist_id}","starred_url":"https://api.github.com/users/spacechop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacechop/subscriptions","organizations_url":"https://api.github.com/users/spacechop/orgs","repos_url":"https://api.github.com/users/spacechop/repos","events_url":"https://api.github.com/users/spacechop/events{/privacy}","received_events_url":"https://api.github.com/users/spacechop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spacechop/spacechop","description":"Fast, simple, scalable HTTP service for high-level image processing with first-class Docker support","fork":false,"url":"https://api.github.com/repos/spacechop/spacechop","forks_url":"https://api.github.com/repos/spacechop/spacechop/forks","keys_url":"https://api.github.com/repos/spacechop/spacechop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spacechop/spacechop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spacechop/spacechop/teams","hooks_url":"https://api.github.com/repos/spacechop/spacechop/hooks","issue_events_url":"https://api.github.com/repos/spacechop/spacechop/issues/events{/number}","events_url":"https://api.github.com/repos/spacechop/spacechop/events","assignees_url":"https://api.github.com/repos/spacechop/spacechop/assignees{/user}","branches_url":"https://api.github.com/repos/spacechop/spacechop/branches{/branch}","tags_url":"https://api.github.com/repos/spacechop/spacechop/tags","blobs_url":"https://api.github.com/repos/spacechop/spacechop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spacechop/spacechop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spacechop/spacechop/git/refs{/sha}","trees_url":"https://api.github.com/repos/spacechop/spacechop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spacechop/spacechop/statuses/{sha}","languages_url":"https://api.github.com/repos/spacechop/spacechop/languages","stargazers_url":"https://api.github.com/repos/spacechop/spacechop/stargazers","contributors_url":"https://api.github.com/repos/spacechop/spacechop/contributors","subscribers_url":"https://api.github.com/repos/spacechop/spacechop/subscribers","subscription_url":"https://api.github.com/repos/spacechop/spacechop/subscription","commits_url":"https://api.github.com/repos/spacechop/spacechop/commits{/sha}","git_commits_url":"https://api.github.com/repos/spacechop/spacechop/git/commits{/sha}","comments_url":"https://api.github.com/repos/spacechop/spacechop/comments{/number}","issue_comment_url":"https://api.github.com/repos/spacechop/spacechop/issues/comments{/number}","contents_url":"https://api.github.com/repos/spacechop/spacechop/contents/{+path}","compare_url":"https://api.github.com/repos/spacechop/spacechop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spacechop/spacechop/merges","archive_url":"https://api.github.com/repos/spacechop/spacechop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spacechop/spacechop/downloads","issues_url":"https://api.github.com/repos/spacechop/spacechop/issues{/number}","pulls_url":"https://api.github.com/repos/spacechop/spacechop/pulls{/number}","milestones_url":"https://api.github.com/repos/spacechop/spacechop/milestones{/number}","notifications_url":"https://api.github.com/repos/spacechop/spacechop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spacechop/spacechop/labels{/name}","releases_url":"https://api.github.com/repos/spacechop/spacechop/releases{/id}","deployments_url":"https://api.github.com/repos/spacechop/spacechop/deployments","created_at":"2018-08-18T21:50:47Z","updated_at":"2018-08-21T03:09:52Z","pushed_at":"2018-08-21T03:11:55Z","git_url":"git://github.com/spacechop/spacechop.git","ssh_url":"git@github.com:spacechop/spacechop.git","clone_url":"https://github.com/spacechop/spacechop.git","svn_url":"https://github.com/spacechop/spacechop","homepage":"","size":7432,"stargazers_count":5,"watchers_count":5,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spacechop/spacechop/pulls/7"},"html":{"href":"https://github.com/spacechop/spacechop/pull/7"},"issue":{"href":"https://api.github.com/repos/spacechop/spacechop/issues/7"},"comments":{"href":"https://api.github.com/repos/spacechop/spacechop/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/spacechop/spacechop/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/spacechop/spacechop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spacechop/spacechop/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/spacechop/spacechop/statuses/e77017cc3e47bf439362392b9c89c5820dc03f17"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ericwenn"}}