{"action":"closed","number":31,"pull_request":{"url":"https://api.github.com/repos/stephenmoloney/fastimage/pulls/31","id":220178551,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwMTc4NTUx","html_url":"https://github.com/stephenmoloney/fastimage/pull/31","diff_url":"https://github.com/stephenmoloney/fastimage/pull/31.diff","patch_url":"https://github.com/stephenmoloney/fastimage/pull/31.patch","issue_url":"https://api.github.com/repos/stephenmoloney/fastimage/issues/31","number":31,"state":"closed","locked":false,"title":"Avoid match error when hackney gets a 403 back","user":{"login":"sneako","id":7762396,"node_id":"MDQ6VXNlcjc3NjIzOTY=","avatar_url":"https://avatars3.githubusercontent.com/u/7762396?v=4","gravatar_id":"","url":"https://api.github.com/users/sneako","html_url":"https://github.com/sneako","followers_url":"https://api.github.com/users/sneako/followers","following_url":"https://api.github.com/users/sneako/following{/other_user}","gists_url":"https://api.github.com/users/sneako/gists{/gist_id}","starred_url":"https://api.github.com/users/sneako/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sneako/subscriptions","organizations_url":"https://api.github.com/users/sneako/orgs","repos_url":"https://api.github.com/users/sneako/repos","events_url":"https://api.github.com/users/sneako/events{/privacy}","received_events_url":"https://api.github.com/users/sneako/received_events","type":"User","site_admin":false},"body":"If `get_acc_with_type/3` returns anything other than `{:ok, %Stream.Acc{}}` we get a match error like:\r\n```\r\n** (MatchError) no match of right hand side value: {:error, %Fastimage.Error{reason: {:hackney_response_error, {\"https://url.that.returns/403.jpg\", 404, \"Not Found\"}}}}\r\n    (fastimage) lib/fastimage.ex:70: Fastimage.type/2\r\n```\r\nI added a very simple test case, which uses a service that just returns a status code based on the url you request, http://httpstat.us/. I usually would avoid write a unit test that makes network calls, but the test suite already does that. An alternative could be to introduce an `HttpClient` behaviour, and then use https://hexdocs.pm/mox/Mox.html in the tests.","created_at":"2018-10-03T21:00:28Z","updated_at":"2018-10-04T00:13:09Z","closed_at":"2018-10-04T00:13:09Z","merged_at":"2018-10-04T00:13:09Z","merge_commit_sha":"564e42dfdf56d2f64028ceec15e70772aaa599d1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/stephenmoloney/fastimage/pulls/31/commits","review_comments_url":"https://api.github.com/repos/stephenmoloney/fastimage/pulls/31/comments","review_comment_url":"https://api.github.com/repos/stephenmoloney/fastimage/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stephenmoloney/fastimage/issues/31/comments","statuses_url":"https://api.github.com/repos/stephenmoloney/fastimage/statuses/51bd7d6250ce1dff19da0c49f1a394d6e91bc9bf","head":{"label":"sneako:403-bug","ref":"403-bug","sha":"51bd7d6250ce1dff19da0c49f1a394d6e91bc9bf","user":{"login":"sneako","id":7762396,"node_id":"MDQ6VXNlcjc3NjIzOTY=","avatar_url":"https://avatars3.githubusercontent.com/u/7762396?v=4","gravatar_id":"","url":"https://api.github.com/users/sneako","html_url":"https://github.com/sneako","followers_url":"https://api.github.com/users/sneako/followers","following_url":"https://api.github.com/users/sneako/following{/other_user}","gists_url":"https://api.github.com/users/sneako/gists{/gist_id}","starred_url":"https://api.github.com/users/sneako/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sneako/subscriptions","organizations_url":"https://api.github.com/users/sneako/orgs","repos_url":"https://api.github.com/users/sneako/repos","events_url":"https://api.github.com/users/sneako/events{/privacy}","received_events_url":"https://api.github.com/users/sneako/received_events","type":"User","site_admin":false},"repo":{"id":151138217,"node_id":"MDEwOlJlcG9zaXRvcnkxNTExMzgyMTc=","name":"fastimage","full_name":"sneako/fastimage","private":false,"owner":{"login":"sneako","id":7762396,"node_id":"MDQ6VXNlcjc3NjIzOTY=","avatar_url":"https://avatars3.githubusercontent.com/u/7762396?v=4","gravatar_id":"","url":"https://api.github.com/users/sneako","html_url":"https://github.com/sneako","followers_url":"https://api.github.com/users/sneako/followers","following_url":"https://api.github.com/users/sneako/following{/other_user}","gists_url":"https://api.github.com/users/sneako/gists{/gist_id}","starred_url":"https://api.github.com/users/sneako/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sneako/subscriptions","organizations_url":"https://api.github.com/users/sneako/orgs","repos_url":"https://api.github.com/users/sneako/repos","events_url":"https://api.github.com/users/sneako/events{/privacy}","received_events_url":"https://api.github.com/users/sneako/received_events","type":"User","site_admin":false},"html_url":"https://github.com/sneako/fastimage","description":"Find the file size or file type of an image given the file path or uri respectively in elixir.","fork":true,"url":"https://api.github.com/repos/sneako/fastimage","forks_url":"https://api.github.com/repos/sneako/fastimage/forks","keys_url":"https://api.github.com/repos/sneako/fastimage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sneako/fastimage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sneako/fastimage/teams","hooks_url":"https://api.github.com/repos/sneako/fastimage/hooks","issue_events_url":"https://api.github.com/repos/sneako/fastimage/issues/events{/number}","events_url":"https://api.github.com/repos/sneako/fastimage/events","assignees_url":"https://api.github.com/repos/sneako/fastimage/assignees{/user}","branches_url":"https://api.github.com/repos/sneako/fastimage/branches{/branch}","tags_url":"https://api.github.com/repos/sneako/fastimage/tags","blobs_url":"https://api.github.com/repos/sneako/fastimage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sneako/fastimage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sneako/fastimage/git/refs{/sha}","trees_url":"https://api.github.com/repos/sneako/fastimage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sneako/fastimage/statuses/{sha}","languages_url":"https://api.github.com/repos/sneako/fastimage/languages","stargazers_url":"https://api.github.com/repos/sneako/fastimage/stargazers","contributors_url":"https://api.github.com/repos/sneako/fastimage/contributors","subscribers_url":"https://api.github.com/repos/sneako/fastimage/subscribers","subscription_url":"https://api.github.com/repos/sneako/fastimage/subscription","commits_url":"https://api.github.com/repos/sneako/fastimage/commits{/sha}","git_commits_url":"https://api.github.com/repos/sneako/fastimage/git/commits{/sha}","comments_url":"https://api.github.com/repos/sneako/fastimage/comments{/number}","issue_comment_url":"https://api.github.com/repos/sneako/fastimage/issues/comments{/number}","contents_url":"https://api.github.com/repos/sneako/fastimage/contents/{+path}","compare_url":"https://api.github.com/repos/sneako/fastimage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sneako/fastimage/merges","archive_url":"https://api.github.com/repos/sneako/fastimage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sneako/fastimage/downloads","issues_url":"https://api.github.com/repos/sneako/fastimage/issues{/number}","pulls_url":"https://api.github.com/repos/sneako/fastimage/pulls{/number}","milestones_url":"https://api.github.com/repos/sneako/fastimage/milestones{/number}","notifications_url":"https://api.github.com/repos/sneako/fastimage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sneako/fastimage/labels{/name}","releases_url":"https://api.github.com/repos/sneako/fastimage/releases{/id}","deployments_url":"https://api.github.com/repos/sneako/fastimage/deployments","created_at":"2018-10-01T18:30:39Z","updated_at":"2018-10-03T20:39:35Z","pushed_at":"2018-10-03T20:54:25Z","git_url":"git://github.com/sneako/fastimage.git","ssh_url":"git@github.com:sneako/fastimage.git","clone_url":"https://github.com/sneako/fastimage.git","svn_url":"https://github.com/sneako/fastimage","homepage":"https://hex.pm/packages/fastimage","size":218,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"stephenmoloney:master","ref":"master","sha":"01562b7eb268b207e0a662d27e6f5380c6e40798","user":{"login":"stephenmoloney","id":12668653,"node_id":"MDQ6VXNlcjEyNjY4NjUz","avatar_url":"https://avatars3.githubusercontent.com/u/12668653?v=4","gravatar_id":"","url":"https://api.github.com/users/stephenmoloney","html_url":"https://github.com/stephenmoloney","followers_url":"https://api.github.com/users/stephenmoloney/followers","following_url":"https://api.github.com/users/stephenmoloney/following{/other_user}","gists_url":"https://api.github.com/users/stephenmoloney/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenmoloney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenmoloney/subscriptions","organizations_url":"https://api.github.com/users/stephenmoloney/orgs","repos_url":"https://api.github.com/users/stephenmoloney/repos","events_url":"https://api.github.com/users/stephenmoloney/events{/privacy}","received_events_url":"https://api.github.com/users/stephenmoloney/received_events","type":"User","site_admin":false},"repo":{"id":65307188,"node_id":"MDEwOlJlcG9zaXRvcnk2NTMwNzE4OA==","name":"fastimage","full_name":"stephenmoloney/fastimage","private":false,"owner":{"login":"stephenmoloney","id":12668653,"node_id":"MDQ6VXNlcjEyNjY4NjUz","avatar_url":"https://avatars3.githubusercontent.com/u/12668653?v=4","gravatar_id":"","url":"https://api.github.com/users/stephenmoloney","html_url":"https://github.com/stephenmoloney","followers_url":"https://api.github.com/users/stephenmoloney/followers","following_url":"https://api.github.com/users/stephenmoloney/following{/other_user}","gists_url":"https://api.github.com/users/stephenmoloney/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenmoloney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenmoloney/subscriptions","organizations_url":"https://api.github.com/users/stephenmoloney/orgs","repos_url":"https://api.github.com/users/stephenmoloney/repos","events_url":"https://api.github.com/users/stephenmoloney/events{/privacy}","received_events_url":"https://api.github.com/users/stephenmoloney/received_events","type":"User","site_admin":false},"html_url":"https://github.com/stephenmoloney/fastimage","description":"Find the type or size of an image","fork":false,"url":"https://api.github.com/repos/stephenmoloney/fastimage","forks_url":"https://api.github.com/repos/stephenmoloney/fastimage/forks","keys_url":"https://api.github.com/repos/stephenmoloney/fastimage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stephenmoloney/fastimage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stephenmoloney/fastimage/teams","hooks_url":"https://api.github.com/repos/stephenmoloney/fastimage/hooks","issue_events_url":"https://api.github.com/repos/stephenmoloney/fastimage/issues/events{/number}","events_url":"https://api.github.com/repos/stephenmoloney/fastimage/events","assignees_url":"https://api.github.com/repos/stephenmoloney/fastimage/assignees{/user}","branches_url":"https://api.github.com/repos/stephenmoloney/fastimage/branches{/branch}","tags_url":"https://api.github.com/repos/stephenmoloney/fastimage/tags","blobs_url":"https://api.github.com/repos/stephenmoloney/fastimage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stephenmoloney/fastimage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stephenmoloney/fastimage/git/refs{/sha}","trees_url":"https://api.github.com/repos/stephenmoloney/fastimage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stephenmoloney/fastimage/statuses/{sha}","languages_url":"https://api.github.com/repos/stephenmoloney/fastimage/languages","stargazers_url":"https://api.github.com/repos/stephenmoloney/fastimage/stargazers","contributors_url":"https://api.github.com/repos/stephenmoloney/fastimage/contributors","subscribers_url":"https://api.github.com/repos/stephenmoloney/fastimage/subscribers","subscription_url":"https://api.github.com/repos/stephenmoloney/fastimage/subscription","commits_url":"https://api.github.com/repos/stephenmoloney/fastimage/commits{/sha}","git_commits_url":"https://api.github.com/repos/stephenmoloney/fastimage/git/commits{/sha}","comments_url":"https://api.github.com/repos/stephenmoloney/fastimage/comments{/number}","issue_comment_url":"https://api.github.com/repos/stephenmoloney/fastimage/issues/comments{/number}","contents_url":"https://api.github.com/repos/stephenmoloney/fastimage/contents/{+path}","compare_url":"https://api.github.com/repos/stephenmoloney/fastimage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stephenmoloney/fastimage/merges","archive_url":"https://api.github.com/repos/stephenmoloney/fastimage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stephenmoloney/fastimage/downloads","issues_url":"https://api.github.com/repos/stephenmoloney/fastimage/issues{/number}","pulls_url":"https://api.github.com/repos/stephenmoloney/fastimage/pulls{/number}","milestones_url":"https://api.github.com/repos/stephenmoloney/fastimage/milestones{/number}","notifications_url":"https://api.github.com/repos/stephenmoloney/fastimage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stephenmoloney/fastimage/labels{/name}","releases_url":"https://api.github.com/repos/stephenmoloney/fastimage/releases{/id}","deployments_url":"https://api.github.com/repos/stephenmoloney/fastimage/deployments","created_at":"2016-08-09T15:39:21Z","updated_at":"2018-10-03T15:10:01Z","pushed_at":"2018-10-04T00:13:09Z","git_url":"git://github.com/stephenmoloney/fastimage.git","ssh_url":"git@github.com:stephenmoloney/fastimage.git","clone_url":"https://github.com/stephenmoloney/fastimage.git","svn_url":"https://github.com/stephenmoloney/fastimage","homepage":"https://hex.pm/packages/fastimage","size":217,"stargazers_count":15,"watchers_count":15,"language":"Elixir","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":5,"open_issues":9,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stephenmoloney/fastimage/pulls/31"},"html":{"href":"https://github.com/stephenmoloney/fastimage/pull/31"},"issue":{"href":"https://api.github.com/repos/stephenmoloney/fastimage/issues/31"},"comments":{"href":"https://api.github.com/repos/stephenmoloney/fastimage/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/stephenmoloney/fastimage/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/stephenmoloney/fastimage/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stephenmoloney/fastimage/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/stephenmoloney/fastimage/statuses/51bd7d6250ce1dff19da0c49f1a394d6e91bc9bf"}},"author_association":"CONTRIBUTOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"stephenmoloney","id":12668653,"node_id":"MDQ6VXNlcjEyNjY4NjUz","avatar_url":"https://avatars3.githubusercontent.com/u/12668653?v=4","gravatar_id":"","url":"https://api.github.com/users/stephenmoloney","html_url":"https://github.com/stephenmoloney","followers_url":"https://api.github.com/users/stephenmoloney/followers","following_url":"https://api.github.com/users/stephenmoloney/following{/other_user}","gists_url":"https://api.github.com/users/stephenmoloney/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenmoloney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenmoloney/subscriptions","organizations_url":"https://api.github.com/users/stephenmoloney/orgs","repos_url":"https://api.github.com/users/stephenmoloney/repos","events_url":"https://api.github.com/users/stephenmoloney/events{/privacy}","received_events_url":"https://api.github.com/users/stephenmoloney/received_events","type":"User","site_admin":false},"comments":2,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":14,"deletions":8,"changed_files":2}}
{"actor":{"display_login":"stephenmoloney"}}