{"action":"created","comment":{"url":"https://api.github.com/repos/devlucky/Kakapo/pulls/comments/74414113","id":74414113,"diff_hunk":"@@ -77,7 +92,35 @@ class RouterTests: QuickSpec {\n             RouterTestServer.disable()\n             Router.disableAll()\n         }\n-        \n+\n+        describe(\"Stop request loading\") {\n+            var router: Router!\n+\n+            beforeEach {\n+                router = Router.register(\"http://www.test.com\")\n+                router.latency = 5 // very high latency to allow us to stop the request before execution\n+            }\n+\n+            it(\"should not start a request, when the request loading is stopped\") {\n+\n+                router.get(\"/users/:id\") { request in\n+                    XCTFail(\"Request should get stopped before and should not get executed\")\n+                    return nil\n+                }\n+\n+                let requestURL = NSURL(string: \"http://www.test.com/users/1\")!\n+                NSURLSession.sharedSession().dataTaskWithURL(requestURL) { (data, response, _) in\n+                    // intentionally empty ... nothing to do here really\n+                }\n+\n+                // We create a \"dummy\" NSURLProtocol object here, which is using the same URL (that we used to\n+                // trigger the request). In order to check the request cancelation.\n+                let urlRequest = NSURLRequest(URL: requestURL)\n+                let urlProtocol = NSURLProtocol(request: urlRequest, cachedResponse: nil, client: nil)\n+                router.stopLoading(urlProtocol)\n+            }\n+        }\n+","path":"Tests/RouterTests.swift","position":74,"original_position":74,"commit_id":"f5d61a93890875a5cab3762afcc70d23786bb1d6","original_commit_id":"f5d61a93890875a5cab3762afcc70d23786bb1d6","user":{"login":"MP0w","id":1812932,"avatar_url":"https://avatars.githubusercontent.com/u/1812932?v=3","gravatar_id":"","url":"https://api.github.com/users/MP0w","html_url":"https://github.com/MP0w","followers_url":"https://api.github.com/users/MP0w/followers","following_url":"https://api.github.com/users/MP0w/following{/other_user}","gists_url":"https://api.github.com/users/MP0w/gists{/gist_id}","starred_url":"https://api.github.com/users/MP0w/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MP0w/subscriptions","organizations_url":"https://api.github.com/users/MP0w/orgs","repos_url":"https://api.github.com/users/MP0w/repos","events_url":"https://api.github.com/users/MP0w/events{/privacy}","received_events_url":"https://api.github.com/users/MP0w/received_events","type":"User","site_admin":false},"body":"AFAIK you have to use XCTFail, anyway we need to give it the time to fail if the request is not correctly cancelled so we need to write the test without canceling implementation to check if they are working fine","created_at":"2016-08-11T12:40:50Z","updated_at":"2016-08-11T12:40:50Z","html_url":"https://github.com/devlucky/Kakapo/pull/96#discussion_r74414113","pull_request_url":"https://api.github.com/repos/devlucky/Kakapo/pulls/96","_links":{"self":{"href":"https://api.github.com/repos/devlucky/Kakapo/pulls/comments/74414113"},"html":{"href":"https://github.com/devlucky/Kakapo/pull/96#discussion_r74414113"},"pull_request":{"href":"https://api.github.com/repos/devlucky/Kakapo/pulls/96"}}},"pull_request":{"url":"https://api.github.com/repos/devlucky/Kakapo/pulls/96","id":80785026,"html_url":"https://github.com/devlucky/Kakapo/pull/96","diff_url":"https://github.com/devlucky/Kakapo/pull/96.diff","patch_url":"https://github.com/devlucky/Kakapo/pull/96.patch","issue_url":"https://api.github.com/repos/devlucky/Kakapo/issues/96","number":96,"state":"open","locked":false,"title":"Implement NSURLProtocol.stopLoading() for delayed requests","user":{"login":"leviathan","id":115210,"avatar_url":"https://avatars.githubusercontent.com/u/115210?v=3","gravatar_id":"","url":"https://api.github.com/users/leviathan","html_url":"https://github.com/leviathan","followers_url":"https://api.github.com/users/leviathan/followers","following_url":"https://api.github.com/users/leviathan/following{/other_user}","gists_url":"https://api.github.com/users/leviathan/gists{/gist_id}","starred_url":"https://api.github.com/users/leviathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leviathan/subscriptions","organizations_url":"https://api.github.com/users/leviathan/orgs","repos_url":"https://api.github.com/users/leviathan/repos","events_url":"https://api.github.com/users/leviathan/events{/privacy}","received_events_url":"https://api.github.com/users/leviathan/received_events","type":"User","site_admin":false},"body":"Implemented the `NSURLProtocol#stopLoading()` logic in `KakapoServer`\r\n\r\nCloses #88 ","created_at":"2016-08-10T12:28:42Z","updated_at":"2016-08-11T12:40:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd9bd51d1b9607c2b0cba56eaca4283366da394f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/devlucky/Kakapo/pulls/96/commits","review_comments_url":"https://api.github.com/repos/devlucky/Kakapo/pulls/96/comments","review_comment_url":"https://api.github.com/repos/devlucky/Kakapo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/devlucky/Kakapo/issues/96/comments","statuses_url":"https://api.github.com/repos/devlucky/Kakapo/statuses/f5d61a93890875a5cab3762afcc70d23786bb1d6","head":{"label":"leviathan:master","ref":"master","sha":"f5d61a93890875a5cab3762afcc70d23786bb1d6","user":{"login":"leviathan","id":115210,"avatar_url":"https://avatars.githubusercontent.com/u/115210?v=3","gravatar_id":"","url":"https://api.github.com/users/leviathan","html_url":"https://github.com/leviathan","followers_url":"https://api.github.com/users/leviathan/followers","following_url":"https://api.github.com/users/leviathan/following{/other_user}","gists_url":"https://api.github.com/users/leviathan/gists{/gist_id}","starred_url":"https://api.github.com/users/leviathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leviathan/subscriptions","organizations_url":"https://api.github.com/users/leviathan/orgs","repos_url":"https://api.github.com/users/leviathan/repos","events_url":"https://api.github.com/users/leviathan/events{/privacy}","received_events_url":"https://api.github.com/users/leviathan/received_events","type":"User","site_admin":false},"repo":{"id":65369342,"name":"Kakapo","full_name":"leviathan/Kakapo","owner":{"login":"leviathan","id":115210,"avatar_url":"https://avatars.githubusercontent.com/u/115210?v=3","gravatar_id":"","url":"https://api.github.com/users/leviathan","html_url":"https://github.com/leviathan","followers_url":"https://api.github.com/users/leviathan/followers","following_url":"https://api.github.com/users/leviathan/following{/other_user}","gists_url":"https://api.github.com/users/leviathan/gists{/gist_id}","starred_url":"https://api.github.com/users/leviathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leviathan/subscriptions","organizations_url":"https://api.github.com/users/leviathan/orgs","repos_url":"https://api.github.com/users/leviathan/repos","events_url":"https://api.github.com/users/leviathan/events{/privacy}","received_events_url":"https://api.github.com/users/leviathan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/leviathan/Kakapo","description":"🐤Dynamically Mock server behaviors and responses in Swift","fork":true,"url":"https://api.github.com/repos/leviathan/Kakapo","forks_url":"https://api.github.com/repos/leviathan/Kakapo/forks","keys_url":"https://api.github.com/repos/leviathan/Kakapo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leviathan/Kakapo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leviathan/Kakapo/teams","hooks_url":"https://api.github.com/repos/leviathan/Kakapo/hooks","issue_events_url":"https://api.github.com/repos/leviathan/Kakapo/issues/events{/number}","events_url":"https://api.github.com/repos/leviathan/Kakapo/events","assignees_url":"https://api.github.com/repos/leviathan/Kakapo/assignees{/user}","branches_url":"https://api.github.com/repos/leviathan/Kakapo/branches{/branch}","tags_url":"https://api.github.com/repos/leviathan/Kakapo/tags","blobs_url":"https://api.github.com/repos/leviathan/Kakapo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leviathan/Kakapo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leviathan/Kakapo/git/refs{/sha}","trees_url":"https://api.github.com/repos/leviathan/Kakapo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leviathan/Kakapo/statuses/{sha}","languages_url":"https://api.github.com/repos/leviathan/Kakapo/languages","stargazers_url":"https://api.github.com/repos/leviathan/Kakapo/stargazers","contributors_url":"https://api.github.com/repos/leviathan/Kakapo/contributors","subscribers_url":"https://api.github.com/repos/leviathan/Kakapo/subscribers","subscription_url":"https://api.github.com/repos/leviathan/Kakapo/subscription","commits_url":"https://api.github.com/repos/leviathan/Kakapo/commits{/sha}","git_commits_url":"https://api.github.com/repos/leviathan/Kakapo/git/commits{/sha}","comments_url":"https://api.github.com/repos/leviathan/Kakapo/comments{/number}","issue_comment_url":"https://api.github.com/repos/leviathan/Kakapo/issues/comments{/number}","contents_url":"https://api.github.com/repos/leviathan/Kakapo/contents/{+path}","compare_url":"https://api.github.com/repos/leviathan/Kakapo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leviathan/Kakapo/merges","archive_url":"https://api.github.com/repos/leviathan/Kakapo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leviathan/Kakapo/downloads","issues_url":"https://api.github.com/repos/leviathan/Kakapo/issues{/number}","pulls_url":"https://api.github.com/repos/leviathan/Kakapo/pulls{/number}","milestones_url":"https://api.github.com/repos/leviathan/Kakapo/milestones{/number}","notifications_url":"https://api.github.com/repos/leviathan/Kakapo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leviathan/Kakapo/labels{/name}","releases_url":"https://api.github.com/repos/leviathan/Kakapo/releases{/id}","deployments_url":"https://api.github.com/repos/leviathan/Kakapo/deployments","created_at":"2016-08-10T09:28:23Z","updated_at":"2016-08-10T09:28:25Z","pushed_at":"2016-08-11T10:22:17Z","git_url":"git://github.com/leviathan/Kakapo.git","ssh_url":"git@github.com:leviathan/Kakapo.git","clone_url":"https://github.com/leviathan/Kakapo.git","svn_url":"https://github.com/leviathan/Kakapo","homepage":"devlucky.github.io/kakapo-swift","size":1431,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"devlucky:master","ref":"master","sha":"33379436a04123a97f34584ada21621dad8e5d3f","user":{"login":"devlucky","id":18127620,"avatar_url":"https://avatars.githubusercontent.com/u/18127620?v=3","gravatar_id":"","url":"https://api.github.com/users/devlucky","html_url":"https://github.com/devlucky","followers_url":"https://api.github.com/users/devlucky/followers","following_url":"https://api.github.com/users/devlucky/following{/other_user}","gists_url":"https://api.github.com/users/devlucky/gists{/gist_id}","starred_url":"https://api.github.com/users/devlucky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devlucky/subscriptions","organizations_url":"https://api.github.com/users/devlucky/orgs","repos_url":"https://api.github.com/users/devlucky/repos","events_url":"https://api.github.com/users/devlucky/events{/privacy}","received_events_url":"https://api.github.com/users/devlucky/received_events","type":"Organization","site_admin":false},"repo":{"id":54993813,"name":"Kakapo","full_name":"devlucky/Kakapo","owner":{"login":"devlucky","id":18127620,"avatar_url":"https://avatars.githubusercontent.com/u/18127620?v=3","gravatar_id":"","url":"https://api.github.com/users/devlucky","html_url":"https://github.com/devlucky","followers_url":"https://api.github.com/users/devlucky/followers","following_url":"https://api.github.com/users/devlucky/following{/other_user}","gists_url":"https://api.github.com/users/devlucky/gists{/gist_id}","starred_url":"https://api.github.com/users/devlucky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devlucky/subscriptions","organizations_url":"https://api.github.com/users/devlucky/orgs","repos_url":"https://api.github.com/users/devlucky/repos","events_url":"https://api.github.com/users/devlucky/events{/privacy}","received_events_url":"https://api.github.com/users/devlucky/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/devlucky/Kakapo","description":"🐤Dynamically Mock server behaviors and responses in Swift","fork":false,"url":"https://api.github.com/repos/devlucky/Kakapo","forks_url":"https://api.github.com/repos/devlucky/Kakapo/forks","keys_url":"https://api.github.com/repos/devlucky/Kakapo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/devlucky/Kakapo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/devlucky/Kakapo/teams","hooks_url":"https://api.github.com/repos/devlucky/Kakapo/hooks","issue_events_url":"https://api.github.com/repos/devlucky/Kakapo/issues/events{/number}","events_url":"https://api.github.com/repos/devlucky/Kakapo/events","assignees_url":"https://api.github.com/repos/devlucky/Kakapo/assignees{/user}","branches_url":"https://api.github.com/repos/devlucky/Kakapo/branches{/branch}","tags_url":"https://api.github.com/repos/devlucky/Kakapo/tags","blobs_url":"https://api.github.com/repos/devlucky/Kakapo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/devlucky/Kakapo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/devlucky/Kakapo/git/refs{/sha}","trees_url":"https://api.github.com/repos/devlucky/Kakapo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/devlucky/Kakapo/statuses/{sha}","languages_url":"https://api.github.com/repos/devlucky/Kakapo/languages","stargazers_url":"https://api.github.com/repos/devlucky/Kakapo/stargazers","contributors_url":"https://api.github.com/repos/devlucky/Kakapo/contributors","subscribers_url":"https://api.github.com/repos/devlucky/Kakapo/subscribers","subscription_url":"https://api.github.com/repos/devlucky/Kakapo/subscription","commits_url":"https://api.github.com/repos/devlucky/Kakapo/commits{/sha}","git_commits_url":"https://api.github.com/repos/devlucky/Kakapo/git/commits{/sha}","comments_url":"https://api.github.com/repos/devlucky/Kakapo/comments{/number}","issue_comment_url":"https://api.github.com/repos/devlucky/Kakapo/issues/comments{/number}","contents_url":"https://api.github.com/repos/devlucky/Kakapo/contents/{+path}","compare_url":"https://api.github.com/repos/devlucky/Kakapo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/devlucky/Kakapo/merges","archive_url":"https://api.github.com/repos/devlucky/Kakapo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/devlucky/Kakapo/downloads","issues_url":"https://api.github.com/repos/devlucky/Kakapo/issues{/number}","pulls_url":"https://api.github.com/repos/devlucky/Kakapo/pulls{/number}","milestones_url":"https://api.github.com/repos/devlucky/Kakapo/milestones{/number}","notifications_url":"https://api.github.com/repos/devlucky/Kakapo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/devlucky/Kakapo/labels{/name}","releases_url":"https://api.github.com/repos/devlucky/Kakapo/releases{/id}","deployments_url":"https://api.github.com/repos/devlucky/Kakapo/deployments","created_at":"2016-03-29T16:57:21Z","updated_at":"2016-08-11T11:09:27Z","pushed_at":"2016-08-11T10:22:17Z","git_url":"git://github.com/devlucky/Kakapo.git","ssh_url":"git@github.com:devlucky/Kakapo.git","clone_url":"https://github.com/devlucky/Kakapo.git","svn_url":"https://github.com/devlucky/Kakapo","homepage":"devlucky.github.io/kakapo-swift","size":1514,"stargazers_count":297,"watchers_count":297,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":9,"forks":11,"open_issues":9,"watchers":297,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/devlucky/Kakapo/pulls/96"},"html":{"href":"https://github.com/devlucky/Kakapo/pull/96"},"issue":{"href":"https://api.github.com/repos/devlucky/Kakapo/issues/96"},"comments":{"href":"https://api.github.com/repos/devlucky/Kakapo/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/devlucky/Kakapo/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/devlucky/Kakapo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/devlucky/Kakapo/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/devlucky/Kakapo/statuses/f5d61a93890875a5cab3762afcc70d23786bb1d6"}}}}
{"actor":{"display_login":"MP0w"}}