{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/comments/42972306","id":42972306,"diff_hunk":"@@ -17,13 +21,24 @@ class ApiClientSpec extends Specification with WireMockHelper {\n     \"not mangle unicode\" in {\n \n       val fixture = new ApiClient {\n-        /** Http client */\n-        override def httpClient: Http = Http\n+        override def get(url: String): Future[HttpResponse] = Future.successful(HttpError(418, \"I'm a teapot\"))\n+        override def post(urlString: String, contentType: ContentType, body: Array[Byte]): Future[HttpResponse] =\n+          execute(url(urlString)\n+            .setMethod(\"POST\")\n+            .setContentType(contentType.mediaType, contentType.charset)\n+            .setBody(body)\n+          )\n+\n+        private def execute(request: Req) = Http(request).map { response =>\n+          if (response.getStatusCode / 100 == 2) {","path":"src/test/scala/com/gu/mobile/notifications/client/ApiClientSpec.scala","position":39,"original_position":39,"commit_id":"ae2e5ec9e90b032d62bfa43064e3f2b9ebd7a23f","original_commit_id":"ae2e5ec9e90b032d62bfa43064e3f2b9ebd7a23f","user":{"login":"agulowaty","id":8526142,"avatar_url":"https://avatars.githubusercontent.com/u/8526142?v=3","gravatar_id":"","url":"https://api.github.com/users/agulowaty","html_url":"https://github.com/agulowaty","followers_url":"https://api.github.com/users/agulowaty/followers","following_url":"https://api.github.com/users/agulowaty/following{/other_user}","gists_url":"https://api.github.com/users/agulowaty/gists{/gist_id}","starred_url":"https://api.github.com/users/agulowaty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agulowaty/subscriptions","organizations_url":"https://api.github.com/users/agulowaty/orgs","repos_url":"https://api.github.com/users/agulowaty/repos","events_url":"https://api.github.com/users/agulowaty/events{/privacy}","received_events_url":"https://api.github.com/users/agulowaty/received_events","type":"User","site_admin":false},"body":"wouldn't be more readable to eliminate that division and do simple check:\r\n```\r\n(200 until 300).contains(response.getStatusCode)\r\n``` \r\n??","created_at":"2015-10-26T09:30:23Z","updated_at":"2015-10-26T09:30:23Z","html_url":"https://github.com/guardian/mobile-notifications-api-client/pull/4#discussion_r42972306","pull_request_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/comments/42972306"},"html":{"href":"https://github.com/guardian/mobile-notifications-api-client/pull/4#discussion_r42972306"},"pull_request":{"href":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/4","id":48594291,"html_url":"https://github.com/guardian/mobile-notifications-api-client/pull/4","diff_url":"https://github.com/guardian/mobile-notifications-api-client/pull/4.diff","patch_url":"https://github.com/guardian/mobile-notifications-api-client/pull/4.patch","issue_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/issues/4","number":4,"state":"open","locked":false,"title":"[WIP] Mapi 1021 generic payload","user":{"login":"alexduf","id":3389563,"avatar_url":"https://avatars.githubusercontent.com/u/3389563?v=3","gravatar_id":"","url":"https://api.github.com/users/alexduf","html_url":"https://github.com/alexduf","followers_url":"https://api.github.com/users/alexduf/followers","following_url":"https://api.github.com/users/alexduf/following{/other_user}","gists_url":"https://api.github.com/users/alexduf/gists{/gist_id}","starred_url":"https://api.github.com/users/alexduf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexduf/subscriptions","organizations_url":"https://api.github.com/users/alexduf/orgs","repos_url":"https://api.github.com/users/alexduf/repos","events_url":"https://api.github.com/users/alexduf/events{/privacy}","received_events_url":"https://api.github.com/users/alexduf/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-23T15:30:40Z","updated_at":"2015-10-26T09:30:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8e7b71faf2e08fe93e196eaf0cf03437eb5ff5d8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/4/commits","review_comments_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/4/comments","review_comment_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/issues/4/comments","statuses_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/statuses/ae2e5ec9e90b032d62bfa43064e3f2b9ebd7a23f","head":{"label":"guardian:MAPI-1021-generic-payload","ref":"MAPI-1021-generic-payload","sha":"ae2e5ec9e90b032d62bfa43064e3f2b9ebd7a23f","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":14956659,"name":"mobile-notifications-api-client","full_name":"guardian/mobile-notifications-api-client","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/mobile-notifications-api-client","description":"Guardian Mobile Notifications API client","fork":false,"url":"https://api.github.com/repos/guardian/mobile-notifications-api-client","forks_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/forks","keys_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/teams","hooks_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/hooks","issue_events_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/events","assignees_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/tags","blobs_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/languages","stargazers_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/stargazers","contributors_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/contributors","subscribers_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/subscribers","subscription_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/subscription","commits_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/merges","archive_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/downloads","issues_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/labels{/name}","releases_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/releases{/id}","created_at":"2013-12-05T15:00:55Z","updated_at":"2015-10-22T21:15:47Z","pushed_at":"2015-10-23T15:30:40Z","git_url":"git://github.com/guardian/mobile-notifications-api-client.git","ssh_url":"git@github.com:guardian/mobile-notifications-api-client.git","clone_url":"https://github.com/guardian/mobile-notifications-api-client.git","svn_url":"https://github.com/guardian/mobile-notifications-api-client","homepage":null,"size":1192,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"fcee352b2c6a0ae2bd1e5c75b25f26e1036080bf","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":14956659,"name":"mobile-notifications-api-client","full_name":"guardian/mobile-notifications-api-client","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/mobile-notifications-api-client","description":"Guardian Mobile Notifications API client","fork":false,"url":"https://api.github.com/repos/guardian/mobile-notifications-api-client","forks_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/forks","keys_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/teams","hooks_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/hooks","issue_events_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/events","assignees_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/tags","blobs_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/languages","stargazers_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/stargazers","contributors_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/contributors","subscribers_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/subscribers","subscription_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/subscription","commits_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/merges","archive_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/downloads","issues_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/labels{/name}","releases_url":"https://api.github.com/repos/guardian/mobile-notifications-api-client/releases{/id}","created_at":"2013-12-05T15:00:55Z","updated_at":"2015-10-22T21:15:47Z","pushed_at":"2015-10-23T15:30:40Z","git_url":"git://github.com/guardian/mobile-notifications-api-client.git","ssh_url":"git@github.com:guardian/mobile-notifications-api-client.git","clone_url":"https://github.com/guardian/mobile-notifications-api-client.git","svn_url":"https://github.com/guardian/mobile-notifications-api-client","homepage":null,"size":1192,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/4"},"html":{"href":"https://github.com/guardian/mobile-notifications-api-client/pull/4"},"issue":{"href":"https://api.github.com/repos/guardian/mobile-notifications-api-client/issues/4"},"comments":{"href":"https://api.github.com/repos/guardian/mobile-notifications-api-client/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/mobile-notifications-api-client/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/mobile-notifications-api-client/statuses/ae2e5ec9e90b032d62bfa43064e3f2b9ebd7a23f"}}}}