{"action":"closed","number":7,"pull_request":{"url":"https://api.github.com/repos/shortify/shortify/pulls/7","id":34685983,"html_url":"https://github.com/shortify/shortify/pull/7","diff_url":"https://github.com/shortify/shortify/pull/7.diff","patch_url":"https://github.com/shortify/shortify/pull/7.patch","issue_url":"https://api.github.com/repos/shortify/shortify/issues/7","number":7,"state":"closed","locked":false,"title":"ensuring valid URLs during creation","user":{"login":"pseudomuto","id":4748863,"avatar_url":"https://avatars.githubusercontent.com/u/4748863?v=3","gravatar_id":"","url":"https://api.github.com/users/pseudomuto","html_url":"https://github.com/pseudomuto","followers_url":"https://api.github.com/users/pseudomuto/followers","following_url":"https://api.github.com/users/pseudomuto/following{/other_user}","gists_url":"https://api.github.com/users/pseudomuto/gists{/gist_id}","starred_url":"https://api.github.com/users/pseudomuto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pseudomuto/subscriptions","organizations_url":"https://api.github.com/users/pseudomuto/orgs","repos_url":"https://api.github.com/users/pseudomuto/repos","events_url":"https://api.github.com/users/pseudomuto/events{/privacy}","received_events_url":"https://api.github.com/users/pseudomuto/received_events","type":"User","site_admin":false},"body":"@Karlhungus @nsimmons\r\n\r\n# The Problem\r\n\r\nAs it stands, you can pass any string as the URL param and shortify will create a redirect for you. Obviously this sucks :8ball:s\r\n\r\n# The Solution\r\n\r\nAdding \"validation\" to the creation handler. Essentially, I've just attempted to parse the URL (via the `net/url` package) and error out (422) if an error occurs or if there is no scheme provided. \r\n\r\nThis means that URLs must be absolute. However, no validation is done regarding which schemes are valid. Not sure if we should enforce a particular set of schemes or not. I mean, do we care if someone shortens a `tcp://` url? My initial thought is that we don't, so I didn't bother here.","created_at":"2015-05-04T23:41:06Z","updated_at":"2015-05-05T14:18:27Z","closed_at":"2015-05-05T14:18:27Z","merged_at":"2015-05-05T14:18:27Z","merge_commit_sha":"ed89d31117f5e67563345bb0de563a1a0031c6d5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/shortify/shortify/pulls/7/commits","review_comments_url":"https://api.github.com/repos/shortify/shortify/pulls/7/comments","review_comment_url":"https://api.github.com/repos/shortify/shortify/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shortify/shortify/issues/7/comments","statuses_url":"https://api.github.com/repos/shortify/shortify/statuses/774d571756cb1dd4b3a2a0d9b788368c2b41b50f","head":{"label":"shortify:prevent_invalid_urls","ref":"prevent_invalid_urls","sha":"774d571756cb1dd4b3a2a0d9b788368c2b41b50f","user":{"login":"shortify","id":12241189,"avatar_url":"https://avatars.githubusercontent.com/u/12241189?v=3","gravatar_id":"","url":"https://api.github.com/users/shortify","html_url":"https://github.com/shortify","followers_url":"https://api.github.com/users/shortify/followers","following_url":"https://api.github.com/users/shortify/following{/other_user}","gists_url":"https://api.github.com/users/shortify/gists{/gist_id}","starred_url":"https://api.github.com/users/shortify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shortify/subscriptions","organizations_url":"https://api.github.com/users/shortify/orgs","repos_url":"https://api.github.com/users/shortify/repos","events_url":"https://api.github.com/users/shortify/events{/privacy}","received_events_url":"https://api.github.com/users/shortify/received_events","type":"Organization","site_admin":false},"repo":{"id":33819280,"name":"shortify","full_name":"shortify/shortify","owner":{"login":"shortify","id":12241189,"avatar_url":"https://avatars.githubusercontent.com/u/12241189?v=3","gravatar_id":"","url":"https://api.github.com/users/shortify","html_url":"https://github.com/shortify","followers_url":"https://api.github.com/users/shortify/followers","following_url":"https://api.github.com/users/shortify/following{/other_user}","gists_url":"https://api.github.com/users/shortify/gists{/gist_id}","starred_url":"https://api.github.com/users/shortify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shortify/subscriptions","organizations_url":"https://api.github.com/users/shortify/orgs","repos_url":"https://api.github.com/users/shortify/repos","events_url":"https://api.github.com/users/shortify/events{/privacy}","received_events_url":"https://api.github.com/users/shortify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shortify/shortify","description":"A simple URL shortener application written in Go","fork":false,"url":"https://api.github.com/repos/shortify/shortify","forks_url":"https://api.github.com/repos/shortify/shortify/forks","keys_url":"https://api.github.com/repos/shortify/shortify/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shortify/shortify/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shortify/shortify/teams","hooks_url":"https://api.github.com/repos/shortify/shortify/hooks","issue_events_url":"https://api.github.com/repos/shortify/shortify/issues/events{/number}","events_url":"https://api.github.com/repos/shortify/shortify/events","assignees_url":"https://api.github.com/repos/shortify/shortify/assignees{/user}","branches_url":"https://api.github.com/repos/shortify/shortify/branches{/branch}","tags_url":"https://api.github.com/repos/shortify/shortify/tags","blobs_url":"https://api.github.com/repos/shortify/shortify/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shortify/shortify/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shortify/shortify/git/refs{/sha}","trees_url":"https://api.github.com/repos/shortify/shortify/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shortify/shortify/statuses/{sha}","languages_url":"https://api.github.com/repos/shortify/shortify/languages","stargazers_url":"https://api.github.com/repos/shortify/shortify/stargazers","contributors_url":"https://api.github.com/repos/shortify/shortify/contributors","subscribers_url":"https://api.github.com/repos/shortify/shortify/subscribers","subscription_url":"https://api.github.com/repos/shortify/shortify/subscription","commits_url":"https://api.github.com/repos/shortify/shortify/commits{/sha}","git_commits_url":"https://api.github.com/repos/shortify/shortify/git/commits{/sha}","comments_url":"https://api.github.com/repos/shortify/shortify/comments{/number}","issue_comment_url":"https://api.github.com/repos/shortify/shortify/issues/comments{/number}","contents_url":"https://api.github.com/repos/shortify/shortify/contents/{+path}","compare_url":"https://api.github.com/repos/shortify/shortify/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shortify/shortify/merges","archive_url":"https://api.github.com/repos/shortify/shortify/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shortify/shortify/downloads","issues_url":"https://api.github.com/repos/shortify/shortify/issues{/number}","pulls_url":"https://api.github.com/repos/shortify/shortify/pulls{/number}","milestones_url":"https://api.github.com/repos/shortify/shortify/milestones{/number}","notifications_url":"https://api.github.com/repos/shortify/shortify/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shortify/shortify/labels{/name}","releases_url":"https://api.github.com/repos/shortify/shortify/releases{/id}","created_at":"2015-04-12T14:09:16Z","updated_at":"2015-05-04T21:11:08Z","pushed_at":"2015-05-05T14:18:27Z","git_url":"git://github.com/shortify/shortify.git","ssh_url":"git@github.com:shortify/shortify.git","clone_url":"https://github.com/shortify/shortify.git","svn_url":"https://github.com/shortify/shortify","homepage":null,"size":268,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"shortify:master","ref":"master","sha":"8f84e0011849a52e0ccb48e37c29a714dfbecf98","user":{"login":"shortify","id":12241189,"avatar_url":"https://avatars.githubusercontent.com/u/12241189?v=3","gravatar_id":"","url":"https://api.github.com/users/shortify","html_url":"https://github.com/shortify","followers_url":"https://api.github.com/users/shortify/followers","following_url":"https://api.github.com/users/shortify/following{/other_user}","gists_url":"https://api.github.com/users/shortify/gists{/gist_id}","starred_url":"https://api.github.com/users/shortify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shortify/subscriptions","organizations_url":"https://api.github.com/users/shortify/orgs","repos_url":"https://api.github.com/users/shortify/repos","events_url":"https://api.github.com/users/shortify/events{/privacy}","received_events_url":"https://api.github.com/users/shortify/received_events","type":"Organization","site_admin":false},"repo":{"id":33819280,"name":"shortify","full_name":"shortify/shortify","owner":{"login":"shortify","id":12241189,"avatar_url":"https://avatars.githubusercontent.com/u/12241189?v=3","gravatar_id":"","url":"https://api.github.com/users/shortify","html_url":"https://github.com/shortify","followers_url":"https://api.github.com/users/shortify/followers","following_url":"https://api.github.com/users/shortify/following{/other_user}","gists_url":"https://api.github.com/users/shortify/gists{/gist_id}","starred_url":"https://api.github.com/users/shortify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shortify/subscriptions","organizations_url":"https://api.github.com/users/shortify/orgs","repos_url":"https://api.github.com/users/shortify/repos","events_url":"https://api.github.com/users/shortify/events{/privacy}","received_events_url":"https://api.github.com/users/shortify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shortify/shortify","description":"A simple URL shortener application written in Go","fork":false,"url":"https://api.github.com/repos/shortify/shortify","forks_url":"https://api.github.com/repos/shortify/shortify/forks","keys_url":"https://api.github.com/repos/shortify/shortify/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shortify/shortify/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shortify/shortify/teams","hooks_url":"https://api.github.com/repos/shortify/shortify/hooks","issue_events_url":"https://api.github.com/repos/shortify/shortify/issues/events{/number}","events_url":"https://api.github.com/repos/shortify/shortify/events","assignees_url":"https://api.github.com/repos/shortify/shortify/assignees{/user}","branches_url":"https://api.github.com/repos/shortify/shortify/branches{/branch}","tags_url":"https://api.github.com/repos/shortify/shortify/tags","blobs_url":"https://api.github.com/repos/shortify/shortify/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shortify/shortify/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shortify/shortify/git/refs{/sha}","trees_url":"https://api.github.com/repos/shortify/shortify/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shortify/shortify/statuses/{sha}","languages_url":"https://api.github.com/repos/shortify/shortify/languages","stargazers_url":"https://api.github.com/repos/shortify/shortify/stargazers","contributors_url":"https://api.github.com/repos/shortify/shortify/contributors","subscribers_url":"https://api.github.com/repos/shortify/shortify/subscribers","subscription_url":"https://api.github.com/repos/shortify/shortify/subscription","commits_url":"https://api.github.com/repos/shortify/shortify/commits{/sha}","git_commits_url":"https://api.github.com/repos/shortify/shortify/git/commits{/sha}","comments_url":"https://api.github.com/repos/shortify/shortify/comments{/number}","issue_comment_url":"https://api.github.com/repos/shortify/shortify/issues/comments{/number}","contents_url":"https://api.github.com/repos/shortify/shortify/contents/{+path}","compare_url":"https://api.github.com/repos/shortify/shortify/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shortify/shortify/merges","archive_url":"https://api.github.com/repos/shortify/shortify/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shortify/shortify/downloads","issues_url":"https://api.github.com/repos/shortify/shortify/issues{/number}","pulls_url":"https://api.github.com/repos/shortify/shortify/pulls{/number}","milestones_url":"https://api.github.com/repos/shortify/shortify/milestones{/number}","notifications_url":"https://api.github.com/repos/shortify/shortify/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shortify/shortify/labels{/name}","releases_url":"https://api.github.com/repos/shortify/shortify/releases{/id}","created_at":"2015-04-12T14:09:16Z","updated_at":"2015-05-04T21:11:08Z","pushed_at":"2015-05-05T14:18:27Z","git_url":"git://github.com/shortify/shortify.git","ssh_url":"git@github.com:shortify/shortify.git","clone_url":"https://github.com/shortify/shortify.git","svn_url":"https://github.com/shortify/shortify","homepage":null,"size":268,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shortify/shortify/pulls/7"},"html":{"href":"https://github.com/shortify/shortify/pull/7"},"issue":{"href":"https://api.github.com/repos/shortify/shortify/issues/7"},"comments":{"href":"https://api.github.com/repos/shortify/shortify/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/shortify/shortify/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/shortify/shortify/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shortify/shortify/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/shortify/shortify/statuses/774d571756cb1dd4b3a2a0d9b788368c2b41b50f"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"pseudomuto","id":4748863,"avatar_url":"https://avatars.githubusercontent.com/u/4748863?v=3","gravatar_id":"","url":"https://api.github.com/users/pseudomuto","html_url":"https://github.com/pseudomuto","followers_url":"https://api.github.com/users/pseudomuto/followers","following_url":"https://api.github.com/users/pseudomuto/following{/other_user}","gists_url":"https://api.github.com/users/pseudomuto/gists{/gist_id}","starred_url":"https://api.github.com/users/pseudomuto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pseudomuto/subscriptions","organizations_url":"https://api.github.com/users/pseudomuto/orgs","repos_url":"https://api.github.com/users/pseudomuto/repos","events_url":"https://api.github.com/users/pseudomuto/events{/privacy}","received_events_url":"https://api.github.com/users/pseudomuto/received_events","type":"User","site_admin":false},"comments":3,"review_comments":1,"commits":2,"additions":47,"deletions":0,"changed_files":2}}