{"action":"created","comment":{"url":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/comments/83777700","pull_request_review_id":4594053,"id":83777700,"diff_hunk":"@@ -0,0 +1,116 @@\n+import {HttpApiClient, HttpClient} from \"../src/httpClient\";\n+\n+describe(\"HttpApiClient\", () => {\n+    let httpApiClient: HttpApiClient;\n+\n+    it(\"should return a valid baseUrl after construction\", () => {\n+\n+        let defaultBaseUrl: string;\n+\n+        let httpClient = new HttpClient();\n+        httpClient.configure((cfg) => {\n+            defaultBaseUrl = cfg.options.baseUrl;\n+        });\n+\n+        httpApiClient = new HttpApiClient();\n+        httpApiClient.configure((cfg) => {\n+            expect(cfg.options.baseUrl).toEqual(defaultBaseUrl);\n+        });\n+\n+        httpApiClient = new HttpApiClient();\n+        expect(httpApiClient.baseUrl).toBeUndefined();\n+\n+        httpApiClient = new HttpApiClient(\"https://myapi.crazy-factory.com\");\n+        expect(httpApiClient.baseUrl).toEqual(\"https://myapi.crazy-factory.com\");\n+\n+    });\n+\n+    it(\"should throw errors for incorrect parameters\", () => {\n+\n+        expect(() => {\n+            httpApiClient.request(\"asdf\", \"/users/1\", undefined, undefined, undefined);\n+        }).toThrowError();\n+\n+    });\n+\n+    it(\"should throw an error on incorrect GET parameters\", () => {\n+\n+        expect(() => {\n+            httpApiClient.request(\"GET\", \"/users/1\", {id: 1}, undefined, undefined);\n+        }).toThrowError();\n+\n+        expect(() => {\n+            httpApiClient.request(\"GET\", \"/users/1\", undefined, [{file: \"iamafile\"}], undefined);\n+        }).toThrowError();\n+\n+    });\n+\n+    it(\"should throw an error on incorrect HEAD parameters\", () => {\n+\n+        expect(() => {\n+            httpApiClient.request(\"HEAD\", \"/users/1\", {id: 1}, undefined, undefined);\n+        }).toThrowError();\n+\n+        expect(() => {\n+            httpApiClient.request(\"HEAD\", \"/users/1\", undefined, [{file: \"iamafile\"}], undefined);\n+        }).toThrowError();\n+\n+    });\n+\n+    it(\"should throw an error on incorrect DELETE parameters\", () => {\n+\n+        expect(() => {\n+            httpApiClient.request(\"DELETE\", \"/users/1\", undefined, [{file: \"iamafile\"}], undefined);\n+        }).toThrowError();\n+\n+    });\n+\n+    it(\"should return a valid promise from get()\", () => {","path":"test/HttpApiClientTest.ts","position":68,"original_position":68,"commit_id":"99ac41bfdd292374058bbfdfe3d1660e63b75bd9","original_commit_id":"99ac41bfdd292374058bbfdfe3d1660e63b75bd9","user":{"login":"wmathes","id":2438066,"avatar_url":"https://avatars.githubusercontent.com/u/2438066?v=3","gravatar_id":"","url":"https://api.github.com/users/wmathes","html_url":"https://github.com/wmathes","followers_url":"https://api.github.com/users/wmathes/followers","following_url":"https://api.github.com/users/wmathes/following{/other_user}","gists_url":"https://api.github.com/users/wmathes/gists{/gist_id}","starred_url":"https://api.github.com/users/wmathes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wmathes/subscriptions","organizations_url":"https://api.github.com/users/wmathes/orgs","repos_url":"https://api.github.com/users/wmathes/repos","events_url":"https://api.github.com/users/wmathes/events{/privacy}","received_events_url":"https://api.github.com/users/wmathes/received_events","type":"User","site_admin":false},"body":"You may test this just once calling request() as all other functions will call request() anyway. You can skip the test for the individual methods.\r\n\r\nAdditionally: Make sure, that they actually call request() and return it's value in the end. You can achieve this by creating a httpApiObject and wrapping/replacing it's request() method. You can then save the return value before it's return to you by get()/post() etc. and compare the result with toBe()\r\n\r\nAlso: Expand this test to use addMiddleware() to return a Promise. There's no need to call a real URL here.","created_at":"2016-10-18T03:48:54Z","updated_at":"2016-10-18T03:48:54Z","html_url":"https://github.com/crazyfactory/ts-http-client/pull/35#discussion_r83777700","pull_request_url":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/comments/83777700"},"html":{"href":"https://github.com/crazyfactory/ts-http-client/pull/35#discussion_r83777700"},"pull_request":{"href":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/35","id":89737044,"html_url":"https://github.com/crazyfactory/ts-http-client/pull/35","diff_url":"https://github.com/crazyfactory/ts-http-client/pull/35.diff","patch_url":"https://github.com/crazyfactory/ts-http-client/pull/35.patch","issue_url":"https://api.github.com/repos/crazyfactory/ts-http-client/issues/35","number":35,"state":"open","locked":false,"title":"Implement http api client","user":{"login":"dacgray","id":12794616,"avatar_url":"https://avatars.githubusercontent.com/u/12794616?v=3","gravatar_id":"","url":"https://api.github.com/users/dacgray","html_url":"https://github.com/dacgray","followers_url":"https://api.github.com/users/dacgray/followers","following_url":"https://api.github.com/users/dacgray/following{/other_user}","gists_url":"https://api.github.com/users/dacgray/gists{/gist_id}","starred_url":"https://api.github.com/users/dacgray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dacgray/subscriptions","organizations_url":"https://api.github.com/users/dacgray/orgs","repos_url":"https://api.github.com/users/dacgray/repos","events_url":"https://api.github.com/users/dacgray/events{/privacy}","received_events_url":"https://api.github.com/users/dacgray/received_events","type":"User","site_admin":false},"body":"#24 ","created_at":"2016-10-18T02:35:53Z","updated_at":"2016-10-18T03:52:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"947eabcc80873a6b4bdf4293c0b9a8920c2acc37","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/35/commits","review_comments_url":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/35/comments","review_comment_url":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crazyfactory/ts-http-client/issues/35/comments","statuses_url":"https://api.github.com/repos/crazyfactory/ts-http-client/statuses/99ac41bfdd292374058bbfdfe3d1660e63b75bd9","head":{"label":"crazyfactory:implement_HttpApiClient","ref":"implement_HttpApiClient","sha":"99ac41bfdd292374058bbfdfe3d1660e63b75bd9","user":{"login":"crazyfactory","id":16873568,"avatar_url":"https://avatars.githubusercontent.com/u/16873568?v=3","gravatar_id":"","url":"https://api.github.com/users/crazyfactory","html_url":"https://github.com/crazyfactory","followers_url":"https://api.github.com/users/crazyfactory/followers","following_url":"https://api.github.com/users/crazyfactory/following{/other_user}","gists_url":"https://api.github.com/users/crazyfactory/gists{/gist_id}","starred_url":"https://api.github.com/users/crazyfactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crazyfactory/subscriptions","organizations_url":"https://api.github.com/users/crazyfactory/orgs","repos_url":"https://api.github.com/users/crazyfactory/repos","events_url":"https://api.github.com/users/crazyfactory/events{/privacy}","received_events_url":"https://api.github.com/users/crazyfactory/received_events","type":"Organization","site_admin":false},"repo":{"id":69311726,"name":"ts-http-client","full_name":"crazyfactory/ts-http-client","owner":{"login":"crazyfactory","id":16873568,"avatar_url":"https://avatars.githubusercontent.com/u/16873568?v=3","gravatar_id":"","url":"https://api.github.com/users/crazyfactory","html_url":"https://github.com/crazyfactory","followers_url":"https://api.github.com/users/crazyfactory/followers","following_url":"https://api.github.com/users/crazyfactory/following{/other_user}","gists_url":"https://api.github.com/users/crazyfactory/gists{/gist_id}","starred_url":"https://api.github.com/users/crazyfactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crazyfactory/subscriptions","organizations_url":"https://api.github.com/users/crazyfactory/orgs","repos_url":"https://api.github.com/users/crazyfactory/repos","events_url":"https://api.github.com/users/crazyfactory/events{/privacy}","received_events_url":"https://api.github.com/users/crazyfactory/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crazyfactory/ts-http-client","description":null,"fork":false,"url":"https://api.github.com/repos/crazyfactory/ts-http-client","forks_url":"https://api.github.com/repos/crazyfactory/ts-http-client/forks","keys_url":"https://api.github.com/repos/crazyfactory/ts-http-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crazyfactory/ts-http-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crazyfactory/ts-http-client/teams","hooks_url":"https://api.github.com/repos/crazyfactory/ts-http-client/hooks","issue_events_url":"https://api.github.com/repos/crazyfactory/ts-http-client/issues/events{/number}","events_url":"https://api.github.com/repos/crazyfactory/ts-http-client/events","assignees_url":"https://api.github.com/repos/crazyfactory/ts-http-client/assignees{/user}","branches_url":"https://api.github.com/repos/crazyfactory/ts-http-client/branches{/branch}","tags_url":"https://api.github.com/repos/crazyfactory/ts-http-client/tags","blobs_url":"https://api.github.com/repos/crazyfactory/ts-http-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crazyfactory/ts-http-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crazyfactory/ts-http-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/crazyfactory/ts-http-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crazyfactory/ts-http-client/statuses/{sha}","languages_url":"https://api.github.com/repos/crazyfactory/ts-http-client/languages","stargazers_url":"https://api.github.com/repos/crazyfactory/ts-http-client/stargazers","contributors_url":"https://api.github.com/repos/crazyfactory/ts-http-client/contributors","subscribers_url":"https://api.github.com/repos/crazyfactory/ts-http-client/subscribers","subscription_url":"https://api.github.com/repos/crazyfactory/ts-http-client/subscription","commits_url":"https://api.github.com/repos/crazyfactory/ts-http-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/crazyfactory/ts-http-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/crazyfactory/ts-http-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/crazyfactory/ts-http-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/crazyfactory/ts-http-client/contents/{+path}","compare_url":"https://api.github.com/repos/crazyfactory/ts-http-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crazyfactory/ts-http-client/merges","archive_url":"https://api.github.com/repos/crazyfactory/ts-http-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crazyfactory/ts-http-client/downloads","issues_url":"https://api.github.com/repos/crazyfactory/ts-http-client/issues{/number}","pulls_url":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls{/number}","milestones_url":"https://api.github.com/repos/crazyfactory/ts-http-client/milestones{/number}","notifications_url":"https://api.github.com/repos/crazyfactory/ts-http-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crazyfactory/ts-http-client/labels{/name}","releases_url":"https://api.github.com/repos/crazyfactory/ts-http-client/releases{/id}","deployments_url":"https://api.github.com/repos/crazyfactory/ts-http-client/deployments","created_at":"2016-09-27T02:30:23Z","updated_at":"2016-10-06T03:30:14Z","pushed_at":"2016-10-18T02:54:00Z","git_url":"git://github.com/crazyfactory/ts-http-client.git","ssh_url":"git@github.com:crazyfactory/ts-http-client.git","clone_url":"https://github.com/crazyfactory/ts-http-client.git","svn_url":"https://github.com/crazyfactory/ts-http-client","homepage":null,"size":73,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"master"}},"base":{"label":"crazyfactory:master","ref":"master","sha":"2a4af500d80ab80750d98ce51fcf3d098fb8c9f7","user":{"login":"crazyfactory","id":16873568,"avatar_url":"https://avatars.githubusercontent.com/u/16873568?v=3","gravatar_id":"","url":"https://api.github.com/users/crazyfactory","html_url":"https://github.com/crazyfactory","followers_url":"https://api.github.com/users/crazyfactory/followers","following_url":"https://api.github.com/users/crazyfactory/following{/other_user}","gists_url":"https://api.github.com/users/crazyfactory/gists{/gist_id}","starred_url":"https://api.github.com/users/crazyfactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crazyfactory/subscriptions","organizations_url":"https://api.github.com/users/crazyfactory/orgs","repos_url":"https://api.github.com/users/crazyfactory/repos","events_url":"https://api.github.com/users/crazyfactory/events{/privacy}","received_events_url":"https://api.github.com/users/crazyfactory/received_events","type":"Organization","site_admin":false},"repo":{"id":69311726,"name":"ts-http-client","full_name":"crazyfactory/ts-http-client","owner":{"login":"crazyfactory","id":16873568,"avatar_url":"https://avatars.githubusercontent.com/u/16873568?v=3","gravatar_id":"","url":"https://api.github.com/users/crazyfactory","html_url":"https://github.com/crazyfactory","followers_url":"https://api.github.com/users/crazyfactory/followers","following_url":"https://api.github.com/users/crazyfactory/following{/other_user}","gists_url":"https://api.github.com/users/crazyfactory/gists{/gist_id}","starred_url":"https://api.github.com/users/crazyfactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crazyfactory/subscriptions","organizations_url":"https://api.github.com/users/crazyfactory/orgs","repos_url":"https://api.github.com/users/crazyfactory/repos","events_url":"https://api.github.com/users/crazyfactory/events{/privacy}","received_events_url":"https://api.github.com/users/crazyfactory/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crazyfactory/ts-http-client","description":null,"fork":false,"url":"https://api.github.com/repos/crazyfactory/ts-http-client","forks_url":"https://api.github.com/repos/crazyfactory/ts-http-client/forks","keys_url":"https://api.github.com/repos/crazyfactory/ts-http-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crazyfactory/ts-http-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crazyfactory/ts-http-client/teams","hooks_url":"https://api.github.com/repos/crazyfactory/ts-http-client/hooks","issue_events_url":"https://api.github.com/repos/crazyfactory/ts-http-client/issues/events{/number}","events_url":"https://api.github.com/repos/crazyfactory/ts-http-client/events","assignees_url":"https://api.github.com/repos/crazyfactory/ts-http-client/assignees{/user}","branches_url":"https://api.github.com/repos/crazyfactory/ts-http-client/branches{/branch}","tags_url":"https://api.github.com/repos/crazyfactory/ts-http-client/tags","blobs_url":"https://api.github.com/repos/crazyfactory/ts-http-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crazyfactory/ts-http-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crazyfactory/ts-http-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/crazyfactory/ts-http-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crazyfactory/ts-http-client/statuses/{sha}","languages_url":"https://api.github.com/repos/crazyfactory/ts-http-client/languages","stargazers_url":"https://api.github.com/repos/crazyfactory/ts-http-client/stargazers","contributors_url":"https://api.github.com/repos/crazyfactory/ts-http-client/contributors","subscribers_url":"https://api.github.com/repos/crazyfactory/ts-http-client/subscribers","subscription_url":"https://api.github.com/repos/crazyfactory/ts-http-client/subscription","commits_url":"https://api.github.com/repos/crazyfactory/ts-http-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/crazyfactory/ts-http-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/crazyfactory/ts-http-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/crazyfactory/ts-http-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/crazyfactory/ts-http-client/contents/{+path}","compare_url":"https://api.github.com/repos/crazyfactory/ts-http-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crazyfactory/ts-http-client/merges","archive_url":"https://api.github.com/repos/crazyfactory/ts-http-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crazyfactory/ts-http-client/downloads","issues_url":"https://api.github.com/repos/crazyfactory/ts-http-client/issues{/number}","pulls_url":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls{/number}","milestones_url":"https://api.github.com/repos/crazyfactory/ts-http-client/milestones{/number}","notifications_url":"https://api.github.com/repos/crazyfactory/ts-http-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crazyfactory/ts-http-client/labels{/name}","releases_url":"https://api.github.com/repos/crazyfactory/ts-http-client/releases{/id}","deployments_url":"https://api.github.com/repos/crazyfactory/ts-http-client/deployments","created_at":"2016-09-27T02:30:23Z","updated_at":"2016-10-06T03:30:14Z","pushed_at":"2016-10-18T02:54:00Z","git_url":"git://github.com/crazyfactory/ts-http-client.git","ssh_url":"git@github.com:crazyfactory/ts-http-client.git","clone_url":"https://github.com/crazyfactory/ts-http-client.git","svn_url":"https://github.com/crazyfactory/ts-http-client","homepage":null,"size":73,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/35"},"html":{"href":"https://github.com/crazyfactory/ts-http-client/pull/35"},"issue":{"href":"https://api.github.com/repos/crazyfactory/ts-http-client/issues/35"},"comments":{"href":"https://api.github.com/repos/crazyfactory/ts-http-client/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crazyfactory/ts-http-client/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/crazyfactory/ts-http-client/statuses/99ac41bfdd292374058bbfdfe3d1660e63b75bd9"}}}}
{"actor":{"display_login":"wmathes"}}