{"action":"created","comment":{"url":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/comments/28026409","id":28026409,"diff_hunk":"@@ -48,490 +48,563 @@ describe('Resources', function() {\n \n \tafterEach(function() {\n \t\txhr.restore();\n+\t\tclock.restore();\n \t\tserver.createScript.restore();\n \t});\n \n-\tdescribe('/v1/open', function() {\n-\t\tit('should pass in app_id and browser_fingerprint_id', function(done) {\n-\t\t\tvar assert = testUtils.plan(5, done);\n-\t\t\tserver.request(resources.open, testUtils.params({ \"is_referrable\": 1 }), storage(), assert.done);\n-\t\t\tassert.equal(requests.length, 1, 'Request made');\n-\t\t\tassert.equal(requests[0].url, 'https://api.branch.io/v1/open', 'Endpoint correct');\n-\t\t\tassert.equal(requests[0].method, 'POST', 'Method correct');\n-\t\t\tassert.equal(requests[0].requestBody, \"app_id=\" + app_id + \"&identity_id=\" + identity_id + \"&is_referrable=1&browser_fingerprint_id=\" + browser_fingerprint_id, 'Data correct');\n-\t\t\trequests[0].respond(200, { \"Content-Type\": \"application/json\" }, '{ \"session_id\": 123 }');\n+\tdescribe('XHR Request', function() {\n+\t\tbeforeEach(function() {\n+\t\t\tsinon.stub(goog.json, \"parse\", function(data) {\n+\t\t\t\treturn data;\n+\t\t\t});\n \t\t});\n \n-\t\tit('should pass as a jsonp request', function(done) {\n-\t\t\tstorage()['setItem']('use_jsonp', true);\n-\n-\t\t\tvar assert = testUtils.plan(3, done);\n+\t\tafterEach(function() {\n+\t\t\tgoog.json.parse.restore();\n+\t\t});\n \n-\t\t\tvar completeParams = testUtils.params({ \"is_referrable\": 1 });\n-\t\t\tserver.request(resources.open, completeParams, storage(), assert.done);\n+\t\tit('should instantiate an XHR', function(done) {\n+\t\t\tvar assert = testUtils.plan(4, done);\n+\t\t\tvar spyCallback = sinon.spy();\n+\t\t\tserver.XHRRequest(resources.profile, testUtils.params({ \"identity\": \"test_id\" }), 'POST', storage(), spyCallback);\n \t\t\tassert.equal(requests.length, 1, 'Request made');\n-\n-\t\t\tvar encodedData = encodeURIComponent(utils.base64encode(goog.json.serialize(completeParams)));\n-\t\t\tassert.equal(requests[0].src, 'https://api.branch.io/v1/open?&data=' + encodedData + '&callback=branch_callback__' + (server._jsonp_callback_index - 1), 'Endpoint correct');\n-\n-\t\t\trequests[0].callback();\n+\t\t\tassert.equal(requests[0].timeout, 5000, 'timeout set to 5s');\n+\t\t\tassert.equal(requests[0].requestHeaders['Content-Type'], 'application/x-www-form-urlencoded;charset=utf-8');\n+\t\t\trequests[0].ontimeout();","path":"tests/1_api.js","position":64,"original_position":64,"commit_id":"ebd7283ff9b5a4b124c227136494ec571d1b042d","original_commit_id":"ebd7283ff9b5a4b124c227136494ec571d1b042d","user":{"login":"scotthasbrouck","id":4266945,"avatar_url":"https://avatars.githubusercontent.com/u/4266945?v=3","gravatar_id":"","url":"https://api.github.com/users/scotthasbrouck","html_url":"https://github.com/scotthasbrouck","followers_url":"https://api.github.com/users/scotthasbrouck/followers","following_url":"https://api.github.com/users/scotthasbrouck/following{/other_user}","gists_url":"https://api.github.com/users/scotthasbrouck/gists{/gist_id}","starred_url":"https://api.github.com/users/scotthasbrouck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scotthasbrouck/subscriptions","organizations_url":"https://api.github.com/users/scotthasbrouck/orgs","repos_url":"https://api.github.com/users/scotthasbrouck/repos","events_url":"https://api.github.com/users/scotthasbrouck/events{/privacy}","received_events_url":"https://api.github.com/users/scotthasbrouck/received_events","type":"User","site_admin":false},"body":"ah yep, clock.tick(5000);","created_at":"2015-04-09T00:12:28Z","updated_at":"2015-04-09T00:12:28Z","html_url":"https://github.com/BranchMetrics/Web-SDK/pull/25#discussion_r28026409","pull_request_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/comments/28026409"},"html":{"href":"https://github.com/BranchMetrics/Web-SDK/pull/25#discussion_r28026409"},"pull_request":{"href":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/25","id":32732729,"html_url":"https://github.com/BranchMetrics/Web-SDK/pull/25","diff_url":"https://github.com/BranchMetrics/Web-SDK/pull/25.diff","patch_url":"https://github.com/BranchMetrics/Web-SDK/pull/25.patch","issue_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/issues/25","number":25,"state":"open","locked":false,"title":"Error not thrown fix","user":{"login":"scotthasbrouck","id":4266945,"avatar_url":"https://avatars.githubusercontent.com/u/4266945?v=3","gravatar_id":"","url":"https://api.github.com/users/scotthasbrouck","html_url":"https://github.com/scotthasbrouck","followers_url":"https://api.github.com/users/scotthasbrouck/followers","following_url":"https://api.github.com/users/scotthasbrouck/following{/other_user}","gists_url":"https://api.github.com/users/scotthasbrouck/gists{/gist_id}","starred_url":"https://api.github.com/users/scotthasbrouck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scotthasbrouck/subscriptions","organizations_url":"https://api.github.com/users/scotthasbrouck/orgs","repos_url":"https://api.github.com/users/scotthasbrouck/repos","events_url":"https://api.github.com/users/scotthasbrouck/events{/privacy}","received_events_url":"https://api.github.com/users/scotthasbrouck/received_events","type":"User","site_admin":false},"body":"@hubt just starting this PR for the client side fix of this issue. We can review this and merge once you have the backend side it fixed","created_at":"2015-04-07T04:29:10Z","updated_at":"2015-04-09T00:12:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76bf2675c78b2864b29b5532f301afeccfd00123","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/25/commits","review_comments_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/25/comments","review_comment_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/issues/25/comments","statuses_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/statuses/ebd7283ff9b5a4b124c227136494ec571d1b042d","head":{"label":"BranchMetrics:error-not-thrown-fix","ref":"error-not-thrown-fix","sha":"ebd7283ff9b5a4b124c227136494ec571d1b042d","user":{"login":"BranchMetrics","id":7772941,"avatar_url":"https://avatars.githubusercontent.com/u/7772941?v=3","gravatar_id":"","url":"https://api.github.com/users/BranchMetrics","html_url":"https://github.com/BranchMetrics","followers_url":"https://api.github.com/users/BranchMetrics/followers","following_url":"https://api.github.com/users/BranchMetrics/following{/other_user}","gists_url":"https://api.github.com/users/BranchMetrics/gists{/gist_id}","starred_url":"https://api.github.com/users/BranchMetrics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BranchMetrics/subscriptions","organizations_url":"https://api.github.com/users/BranchMetrics/orgs","repos_url":"https://api.github.com/users/BranchMetrics/repos","events_url":"https://api.github.com/users/BranchMetrics/events{/privacy}","received_events_url":"https://api.github.com/users/BranchMetrics/received_events","type":"Organization","site_admin":false},"repo":{"id":25227902,"name":"Web-SDK","full_name":"BranchMetrics/Web-SDK","owner":{"login":"BranchMetrics","id":7772941,"avatar_url":"https://avatars.githubusercontent.com/u/7772941?v=3","gravatar_id":"","url":"https://api.github.com/users/BranchMetrics","html_url":"https://github.com/BranchMetrics","followers_url":"https://api.github.com/users/BranchMetrics/followers","following_url":"https://api.github.com/users/BranchMetrics/following{/other_user}","gists_url":"https://api.github.com/users/BranchMetrics/gists{/gist_id}","starred_url":"https://api.github.com/users/BranchMetrics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BranchMetrics/subscriptions","organizations_url":"https://api.github.com/users/BranchMetrics/orgs","repos_url":"https://api.github.com/users/BranchMetrics/repos","events_url":"https://api.github.com/users/BranchMetrics/events{/privacy}","received_events_url":"https://api.github.com/users/BranchMetrics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BranchMetrics/Web-SDK","description":"Branch Metrics Web SDK","fork":false,"url":"https://api.github.com/repos/BranchMetrics/Web-SDK","forks_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/forks","keys_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/teams","hooks_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/hooks","issue_events_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/issues/events{/number}","events_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/events","assignees_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/assignees{/user}","branches_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/branches{/branch}","tags_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/tags","blobs_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/git/refs{/sha}","trees_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/statuses/{sha}","languages_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/languages","stargazers_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/stargazers","contributors_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/contributors","subscribers_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/subscribers","subscription_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/subscription","commits_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/commits{/sha}","git_commits_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/git/commits{/sha}","comments_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/comments{/number}","issue_comment_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/issues/comments{/number}","contents_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/contents/{+path}","compare_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/merges","archive_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/downloads","issues_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/issues{/number}","pulls_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls{/number}","milestones_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/milestones{/number}","notifications_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/labels{/name}","releases_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/releases{/id}","created_at":"2014-10-14T21:41:36Z","updated_at":"2015-04-08T00:25:15Z","pushed_at":"2015-04-09T00:06:12Z","git_url":"git://github.com/BranchMetrics/Web-SDK.git","ssh_url":"git@github.com:BranchMetrics/Web-SDK.git","clone_url":"https://github.com/BranchMetrics/Web-SDK.git","svn_url":"https://github.com/BranchMetrics/Web-SDK","homepage":"http://branch.io","size":13739,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":1,"forks":8,"open_issues":1,"watchers":7,"default_branch":"master"}},"base":{"label":"BranchMetrics:master","ref":"master","sha":"cc6b814469b0ffd40c36bde163ed58b3ee2f5ec1","user":{"login":"BranchMetrics","id":7772941,"avatar_url":"https://avatars.githubusercontent.com/u/7772941?v=3","gravatar_id":"","url":"https://api.github.com/users/BranchMetrics","html_url":"https://github.com/BranchMetrics","followers_url":"https://api.github.com/users/BranchMetrics/followers","following_url":"https://api.github.com/users/BranchMetrics/following{/other_user}","gists_url":"https://api.github.com/users/BranchMetrics/gists{/gist_id}","starred_url":"https://api.github.com/users/BranchMetrics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BranchMetrics/subscriptions","organizations_url":"https://api.github.com/users/BranchMetrics/orgs","repos_url":"https://api.github.com/users/BranchMetrics/repos","events_url":"https://api.github.com/users/BranchMetrics/events{/privacy}","received_events_url":"https://api.github.com/users/BranchMetrics/received_events","type":"Organization","site_admin":false},"repo":{"id":25227902,"name":"Web-SDK","full_name":"BranchMetrics/Web-SDK","owner":{"login":"BranchMetrics","id":7772941,"avatar_url":"https://avatars.githubusercontent.com/u/7772941?v=3","gravatar_id":"","url":"https://api.github.com/users/BranchMetrics","html_url":"https://github.com/BranchMetrics","followers_url":"https://api.github.com/users/BranchMetrics/followers","following_url":"https://api.github.com/users/BranchMetrics/following{/other_user}","gists_url":"https://api.github.com/users/BranchMetrics/gists{/gist_id}","starred_url":"https://api.github.com/users/BranchMetrics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BranchMetrics/subscriptions","organizations_url":"https://api.github.com/users/BranchMetrics/orgs","repos_url":"https://api.github.com/users/BranchMetrics/repos","events_url":"https://api.github.com/users/BranchMetrics/events{/privacy}","received_events_url":"https://api.github.com/users/BranchMetrics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BranchMetrics/Web-SDK","description":"Branch Metrics Web SDK","fork":false,"url":"https://api.github.com/repos/BranchMetrics/Web-SDK","forks_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/forks","keys_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/teams","hooks_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/hooks","issue_events_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/issues/events{/number}","events_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/events","assignees_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/assignees{/user}","branches_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/branches{/branch}","tags_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/tags","blobs_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/git/refs{/sha}","trees_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/statuses/{sha}","languages_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/languages","stargazers_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/stargazers","contributors_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/contributors","subscribers_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/subscribers","subscription_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/subscription","commits_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/commits{/sha}","git_commits_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/git/commits{/sha}","comments_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/comments{/number}","issue_comment_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/issues/comments{/number}","contents_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/contents/{+path}","compare_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/merges","archive_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/downloads","issues_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/issues{/number}","pulls_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls{/number}","milestones_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/milestones{/number}","notifications_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/labels{/name}","releases_url":"https://api.github.com/repos/BranchMetrics/Web-SDK/releases{/id}","created_at":"2014-10-14T21:41:36Z","updated_at":"2015-04-08T00:25:15Z","pushed_at":"2015-04-09T00:06:12Z","git_url":"git://github.com/BranchMetrics/Web-SDK.git","ssh_url":"git@github.com:BranchMetrics/Web-SDK.git","clone_url":"https://github.com/BranchMetrics/Web-SDK.git","svn_url":"https://github.com/BranchMetrics/Web-SDK","homepage":"http://branch.io","size":13739,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":1,"forks":8,"open_issues":1,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/25"},"html":{"href":"https://github.com/BranchMetrics/Web-SDK/pull/25"},"issue":{"href":"https://api.github.com/repos/BranchMetrics/Web-SDK/issues/25"},"comments":{"href":"https://api.github.com/repos/BranchMetrics/Web-SDK/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BranchMetrics/Web-SDK/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/BranchMetrics/Web-SDK/statuses/ebd7283ff9b5a4b124c227136494ec571d1b042d"}}}}