{"action":"closed","number":81,"pull_request":{"url":"https://api.github.com/repos/swoosh/swoosh/pulls/81","id":70113990,"html_url":"https://github.com/swoosh/swoosh/pull/81","diff_url":"https://github.com/swoosh/swoosh/pull/81.diff","patch_url":"https://github.com/swoosh/swoosh/pull/81.patch","issue_url":"https://api.github.com/repos/swoosh/swoosh/issues/81","number":81,"state":"closed","locked":false,"title":"Handle 401 response from Mailgun","user":{"login":"monicao","id":165790,"avatar_url":"https://avatars.githubusercontent.com/u/165790?v=3","gravatar_id":"","url":"https://api.github.com/users/monicao","html_url":"https://github.com/monicao","followers_url":"https://api.github.com/users/monicao/followers","following_url":"https://api.github.com/users/monicao/following{/other_user}","gists_url":"https://api.github.com/users/monicao/gists{/gist_id}","starred_url":"https://api.github.com/users/monicao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monicao/subscriptions","organizations_url":"https://api.github.com/users/monicao/orgs","repos_url":"https://api.github.com/users/monicao/repos","events_url":"https://api.github.com/users/monicao/events{/privacy}","received_events_url":"https://api.github.com/users/monicao/received_events","type":"User","site_admin":false},"body":"The Mailgun adapter expects a JSON response from the API when the response is a 401 (`:api_key` is invalid). Mailgun returns the string \"Forbidden\" instead, which causes a exception.\r\n\r\n```\r\ntest wrong api key (Swoosh.Integration.Adapters.MailgunTest)\r\n     test/integration/adapters/mailgun_test.exs:29\r\n     ** (Poison.SyntaxError) Unexpected token: F\r\n     stacktrace:\r\n       lib/poison/parser.ex:56: Poison.Parser.parse!/2\r\n       lib/poison.ex:83: Poison.decode!/2\r\n       (swoosh) lib/swoosh/adapters/mailgun.ex:37: Swoosh.Adapters.Mailgun.deliver/2\r\n       test/integration/adapters/mailgun_test.exs:39\r\n```\r\n\r\nHere is a proposed solution. I didn't actually check that the other status codes also return a string, but I think that's safe to assume that's the case. The docs https://documentation.mailgun.com/api-intro.html#errors are silent.\r\n","created_at":"2016-05-15T06:56:32Z","updated_at":"2016-06-21T23:04:11Z","closed_at":"2016-06-21T23:04:10Z","merged_at":"2016-06-21T23:04:10Z","merge_commit_sha":"ef8030229695d91885591863dbf198daf438aef7","assignee":{"login":"stevedomin","id":512246,"avatar_url":"https://avatars.githubusercontent.com/u/512246?v=3","gravatar_id":"","url":"https://api.github.com/users/stevedomin","html_url":"https://github.com/stevedomin","followers_url":"https://api.github.com/users/stevedomin/followers","following_url":"https://api.github.com/users/stevedomin/following{/other_user}","gists_url":"https://api.github.com/users/stevedomin/gists{/gist_id}","starred_url":"https://api.github.com/users/stevedomin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevedomin/subscriptions","organizations_url":"https://api.github.com/users/stevedomin/orgs","repos_url":"https://api.github.com/users/stevedomin/repos","events_url":"https://api.github.com/users/stevedomin/events{/privacy}","received_events_url":"https://api.github.com/users/stevedomin/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/swoosh/swoosh/pulls/81/commits","review_comments_url":"https://api.github.com/repos/swoosh/swoosh/pulls/81/comments","review_comment_url":"https://api.github.com/repos/swoosh/swoosh/pulls/comments{/number}","comments_url":"https://api.github.com/repos/swoosh/swoosh/issues/81/comments","statuses_url":"https://api.github.com/repos/swoosh/swoosh/statuses/7526ef676e77b07f011b0929854f1a9c739ca461","head":{"label":"monicao:fix_mailgun_response_401","ref":"fix_mailgun_response_401","sha":"7526ef676e77b07f011b0929854f1a9c739ca461","user":{"login":"monicao","id":165790,"avatar_url":"https://avatars.githubusercontent.com/u/165790?v=3","gravatar_id":"","url":"https://api.github.com/users/monicao","html_url":"https://github.com/monicao","followers_url":"https://api.github.com/users/monicao/followers","following_url":"https://api.github.com/users/monicao/following{/other_user}","gists_url":"https://api.github.com/users/monicao/gists{/gist_id}","starred_url":"https://api.github.com/users/monicao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monicao/subscriptions","organizations_url":"https://api.github.com/users/monicao/orgs","repos_url":"https://api.github.com/users/monicao/repos","events_url":"https://api.github.com/users/monicao/events{/privacy}","received_events_url":"https://api.github.com/users/monicao/received_events","type":"User","site_admin":false},"repo":{"id":58842344,"name":"swoosh","full_name":"monicao/swoosh","owner":{"login":"monicao","id":165790,"avatar_url":"https://avatars.githubusercontent.com/u/165790?v=3","gravatar_id":"","url":"https://api.github.com/users/monicao","html_url":"https://github.com/monicao","followers_url":"https://api.github.com/users/monicao/followers","following_url":"https://api.github.com/users/monicao/following{/other_user}","gists_url":"https://api.github.com/users/monicao/gists{/gist_id}","starred_url":"https://api.github.com/users/monicao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monicao/subscriptions","organizations_url":"https://api.github.com/users/monicao/orgs","repos_url":"https://api.github.com/users/monicao/repos","events_url":"https://api.github.com/users/monicao/events{/privacy}","received_events_url":"https://api.github.com/users/monicao/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/monicao/swoosh","description":"Compose, deliver and test your emails easily in Elixir -","fork":true,"url":"https://api.github.com/repos/monicao/swoosh","forks_url":"https://api.github.com/repos/monicao/swoosh/forks","keys_url":"https://api.github.com/repos/monicao/swoosh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/monicao/swoosh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/monicao/swoosh/teams","hooks_url":"https://api.github.com/repos/monicao/swoosh/hooks","issue_events_url":"https://api.github.com/repos/monicao/swoosh/issues/events{/number}","events_url":"https://api.github.com/repos/monicao/swoosh/events","assignees_url":"https://api.github.com/repos/monicao/swoosh/assignees{/user}","branches_url":"https://api.github.com/repos/monicao/swoosh/branches{/branch}","tags_url":"https://api.github.com/repos/monicao/swoosh/tags","blobs_url":"https://api.github.com/repos/monicao/swoosh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/monicao/swoosh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/monicao/swoosh/git/refs{/sha}","trees_url":"https://api.github.com/repos/monicao/swoosh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/monicao/swoosh/statuses/{sha}","languages_url":"https://api.github.com/repos/monicao/swoosh/languages","stargazers_url":"https://api.github.com/repos/monicao/swoosh/stargazers","contributors_url":"https://api.github.com/repos/monicao/swoosh/contributors","subscribers_url":"https://api.github.com/repos/monicao/swoosh/subscribers","subscription_url":"https://api.github.com/repos/monicao/swoosh/subscription","commits_url":"https://api.github.com/repos/monicao/swoosh/commits{/sha}","git_commits_url":"https://api.github.com/repos/monicao/swoosh/git/commits{/sha}","comments_url":"https://api.github.com/repos/monicao/swoosh/comments{/number}","issue_comment_url":"https://api.github.com/repos/monicao/swoosh/issues/comments{/number}","contents_url":"https://api.github.com/repos/monicao/swoosh/contents/{+path}","compare_url":"https://api.github.com/repos/monicao/swoosh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/monicao/swoosh/merges","archive_url":"https://api.github.com/repos/monicao/swoosh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/monicao/swoosh/downloads","issues_url":"https://api.github.com/repos/monicao/swoosh/issues{/number}","pulls_url":"https://api.github.com/repos/monicao/swoosh/pulls{/number}","milestones_url":"https://api.github.com/repos/monicao/swoosh/milestones{/number}","notifications_url":"https://api.github.com/repos/monicao/swoosh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/monicao/swoosh/labels{/name}","releases_url":"https://api.github.com/repos/monicao/swoosh/releases{/id}","deployments_url":"https://api.github.com/repos/monicao/swoosh/deployments","created_at":"2016-05-15T03:30:56Z","updated_at":"2016-05-15T03:30:57Z","pushed_at":"2016-06-21T22:02:47Z","git_url":"git://github.com/monicao/swoosh.git","ssh_url":"git@github.com:monicao/swoosh.git","clone_url":"https://github.com/monicao/swoosh.git","svn_url":"https://github.com/monicao/swoosh","homepage":"https://hexdocs.pm/swoosh","size":502,"stargazers_count":0,"watchers_count":0,"language":"Elixir","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":"swoosh:master","ref":"master","sha":"938b2bebf2097e9376867c0d10ce306ca3ce4ac0","user":{"login":"swoosh","id":17713874,"avatar_url":"https://avatars.githubusercontent.com/u/17713874?v=3","gravatar_id":"","url":"https://api.github.com/users/swoosh","html_url":"https://github.com/swoosh","followers_url":"https://api.github.com/users/swoosh/followers","following_url":"https://api.github.com/users/swoosh/following{/other_user}","gists_url":"https://api.github.com/users/swoosh/gists{/gist_id}","starred_url":"https://api.github.com/users/swoosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swoosh/subscriptions","organizations_url":"https://api.github.com/users/swoosh/orgs","repos_url":"https://api.github.com/users/swoosh/repos","events_url":"https://api.github.com/users/swoosh/events{/privacy}","received_events_url":"https://api.github.com/users/swoosh/received_events","type":"Organization","site_admin":false},"repo":{"id":53172916,"name":"swoosh","full_name":"swoosh/swoosh","owner":{"login":"swoosh","id":17713874,"avatar_url":"https://avatars.githubusercontent.com/u/17713874?v=3","gravatar_id":"","url":"https://api.github.com/users/swoosh","html_url":"https://github.com/swoosh","followers_url":"https://api.github.com/users/swoosh/followers","following_url":"https://api.github.com/users/swoosh/following{/other_user}","gists_url":"https://api.github.com/users/swoosh/gists{/gist_id}","starred_url":"https://api.github.com/users/swoosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swoosh/subscriptions","organizations_url":"https://api.github.com/users/swoosh/orgs","repos_url":"https://api.github.com/users/swoosh/repos","events_url":"https://api.github.com/users/swoosh/events{/privacy}","received_events_url":"https://api.github.com/users/swoosh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/swoosh/swoosh","description":"Compose, deliver and test your emails easily in Elixir -","fork":false,"url":"https://api.github.com/repos/swoosh/swoosh","forks_url":"https://api.github.com/repos/swoosh/swoosh/forks","keys_url":"https://api.github.com/repos/swoosh/swoosh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/swoosh/swoosh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/swoosh/swoosh/teams","hooks_url":"https://api.github.com/repos/swoosh/swoosh/hooks","issue_events_url":"https://api.github.com/repos/swoosh/swoosh/issues/events{/number}","events_url":"https://api.github.com/repos/swoosh/swoosh/events","assignees_url":"https://api.github.com/repos/swoosh/swoosh/assignees{/user}","branches_url":"https://api.github.com/repos/swoosh/swoosh/branches{/branch}","tags_url":"https://api.github.com/repos/swoosh/swoosh/tags","blobs_url":"https://api.github.com/repos/swoosh/swoosh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/swoosh/swoosh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/swoosh/swoosh/git/refs{/sha}","trees_url":"https://api.github.com/repos/swoosh/swoosh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/swoosh/swoosh/statuses/{sha}","languages_url":"https://api.github.com/repos/swoosh/swoosh/languages","stargazers_url":"https://api.github.com/repos/swoosh/swoosh/stargazers","contributors_url":"https://api.github.com/repos/swoosh/swoosh/contributors","subscribers_url":"https://api.github.com/repos/swoosh/swoosh/subscribers","subscription_url":"https://api.github.com/repos/swoosh/swoosh/subscription","commits_url":"https://api.github.com/repos/swoosh/swoosh/commits{/sha}","git_commits_url":"https://api.github.com/repos/swoosh/swoosh/git/commits{/sha}","comments_url":"https://api.github.com/repos/swoosh/swoosh/comments{/number}","issue_comment_url":"https://api.github.com/repos/swoosh/swoosh/issues/comments{/number}","contents_url":"https://api.github.com/repos/swoosh/swoosh/contents/{+path}","compare_url":"https://api.github.com/repos/swoosh/swoosh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/swoosh/swoosh/merges","archive_url":"https://api.github.com/repos/swoosh/swoosh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/swoosh/swoosh/downloads","issues_url":"https://api.github.com/repos/swoosh/swoosh/issues{/number}","pulls_url":"https://api.github.com/repos/swoosh/swoosh/pulls{/number}","milestones_url":"https://api.github.com/repos/swoosh/swoosh/milestones{/number}","notifications_url":"https://api.github.com/repos/swoosh/swoosh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/swoosh/swoosh/labels{/name}","releases_url":"https://api.github.com/repos/swoosh/swoosh/releases{/id}","deployments_url":"https://api.github.com/repos/swoosh/swoosh/deployments","created_at":"2016-03-04T23:48:56Z","updated_at":"2016-06-21T07:33:46Z","pushed_at":"2016-06-21T23:04:11Z","git_url":"git://github.com/swoosh/swoosh.git","ssh_url":"git@github.com:swoosh/swoosh.git","clone_url":"https://github.com/swoosh/swoosh.git","svn_url":"https://github.com/swoosh/swoosh","homepage":"https://hexdocs.pm/swoosh","size":505,"stargazers_count":190,"watchers_count":190,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":8,"forks":18,"open_issues":8,"watchers":190,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/swoosh/swoosh/pulls/81"},"html":{"href":"https://github.com/swoosh/swoosh/pull/81"},"issue":{"href":"https://api.github.com/repos/swoosh/swoosh/issues/81"},"comments":{"href":"https://api.github.com/repos/swoosh/swoosh/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/swoosh/swoosh/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/swoosh/swoosh/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/swoosh/swoosh/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/swoosh/swoosh/statuses/7526ef676e77b07f011b0929854f1a9c739ca461"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"stevedomin","id":512246,"avatar_url":"https://avatars.githubusercontent.com/u/512246?v=3","gravatar_id":"","url":"https://api.github.com/users/stevedomin","html_url":"https://github.com/stevedomin","followers_url":"https://api.github.com/users/stevedomin/followers","following_url":"https://api.github.com/users/stevedomin/following{/other_user}","gists_url":"https://api.github.com/users/stevedomin/gists{/gist_id}","starred_url":"https://api.github.com/users/stevedomin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevedomin/subscriptions","organizations_url":"https://api.github.com/users/stevedomin/orgs","repos_url":"https://api.github.com/users/stevedomin/repos","events_url":"https://api.github.com/users/stevedomin/events{/privacy}","received_events_url":"https://api.github.com/users/stevedomin/received_events","type":"User","site_admin":false},"comments":11,"review_comments":0,"commits":1,"additions":17,"deletions":2,"changed_files":3}}
{"actor":{"display_login":"stevedomin"}}