{"action":"created","comment":{"url":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/comments/39066935","id":39066935,"diff_hunk":"@@ -24,10 +24,22 @@ var serve = function(options) {\n \n         fileServer.serve(request, response, function(err, res) {\n           if (err) {\n-            log(chalk.red(\"[\" + err.status + \"] \" + request.url), true);\n-\n-            response.writeHead(err.status, err.headers);\n-            response.end(\"Not found\");\n+            if (options.redirects[request.url]) {\n+              log(chalk.yellow(\"[\" + 301 + \"] \" + request.url + \" > \" + options.redirects[request.url]), true);","path":"lib/index.js","position":9,"original_position":9,"commit_id":"c9325ccdd12fe4ddd3a14b6800e751fa63e63ca6","original_commit_id":"c9325ccdd12fe4ddd3a14b6800e751fa63e63ca6","user":{"login":"mayo","id":2772,"avatar_url":"https://avatars.githubusercontent.com/u/2772?v=3","gravatar_id":"","url":"https://api.github.com/users/mayo","html_url":"https://github.com/mayo","followers_url":"https://api.github.com/users/mayo/followers","following_url":"https://api.github.com/users/mayo/following{/other_user}","gists_url":"https://api.github.com/users/mayo/gists{/gist_id}","starred_url":"https://api.github.com/users/mayo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mayo/subscriptions","organizations_url":"https://api.github.com/users/mayo/orgs","repos_url":"https://api.github.com/users/mayo/repos","events_url":"https://api.github.com/users/mayo/events{/privacy}","received_events_url":"https://api.github.com/users/mayo/received_events","type":"User","site_admin":false},"body":"Would be nice if the error numbers were defined as constants","created_at":"2015-09-09T16:45:13Z","updated_at":"2015-09-09T16:45:13Z","html_url":"https://github.com/mayo/metalsmith-serve/pull/7#discussion_r39066935","pull_request_url":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/comments/39066935"},"html":{"href":"https://github.com/mayo/metalsmith-serve/pull/7#discussion_r39066935"},"pull_request":{"href":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/7","id":44262324,"html_url":"https://github.com/mayo/metalsmith-serve/pull/7","diff_url":"https://github.com/mayo/metalsmith-serve/pull/7.diff","patch_url":"https://github.com/mayo/metalsmith-serve/pull/7.patch","issue_url":"https://api.github.com/repos/mayo/metalsmith-serve/issues/7","number":7,"state":"open","locked":false,"title":"Added options for 404 file serving and 301 redirects","user":{"login":"woodyrew","id":1902064,"avatar_url":"https://avatars.githubusercontent.com/u/1902064?v=3","gravatar_id":"","url":"https://api.github.com/users/woodyrew","html_url":"https://github.com/woodyrew","followers_url":"https://api.github.com/users/woodyrew/followers","following_url":"https://api.github.com/users/woodyrew/following{/other_user}","gists_url":"https://api.github.com/users/woodyrew/gists{/gist_id}","starred_url":"https://api.github.com/users/woodyrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woodyrew/subscriptions","organizations_url":"https://api.github.com/users/woodyrew/orgs","repos_url":"https://api.github.com/users/woodyrew/repos","events_url":"https://api.github.com/users/woodyrew/events{/privacy}","received_events_url":"https://api.github.com/users/woodyrew/received_events","type":"User","site_admin":false},"body":"Documented and added tests also.\r\n\r\nI've not bumped the version, changes don't break existing functionality so probably a minor bump is all that is required.","created_at":"2015-09-04T21:16:14Z","updated_at":"2015-09-09T16:45:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2aee05f8ac37b26dbd34d9007d0af29a81367f7f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/7/commits","review_comments_url":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/7/comments","review_comment_url":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mayo/metalsmith-serve/issues/7/comments","statuses_url":"https://api.github.com/repos/mayo/metalsmith-serve/statuses/c9325ccdd12fe4ddd3a14b6800e751fa63e63ca6","head":{"label":"woodyrew:master","ref":"master","sha":"c9325ccdd12fe4ddd3a14b6800e751fa63e63ca6","user":{"login":"woodyrew","id":1902064,"avatar_url":"https://avatars.githubusercontent.com/u/1902064?v=3","gravatar_id":"","url":"https://api.github.com/users/woodyrew","html_url":"https://github.com/woodyrew","followers_url":"https://api.github.com/users/woodyrew/followers","following_url":"https://api.github.com/users/woodyrew/following{/other_user}","gists_url":"https://api.github.com/users/woodyrew/gists{/gist_id}","starred_url":"https://api.github.com/users/woodyrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woodyrew/subscriptions","organizations_url":"https://api.github.com/users/woodyrew/orgs","repos_url":"https://api.github.com/users/woodyrew/repos","events_url":"https://api.github.com/users/woodyrew/events{/privacy}","received_events_url":"https://api.github.com/users/woodyrew/received_events","type":"User","site_admin":false},"repo":{"id":41918210,"name":"metalsmith-serve","full_name":"woodyrew/metalsmith-serve","owner":{"login":"woodyrew","id":1902064,"avatar_url":"https://avatars.githubusercontent.com/u/1902064?v=3","gravatar_id":"","url":"https://api.github.com/users/woodyrew","html_url":"https://github.com/woodyrew","followers_url":"https://api.github.com/users/woodyrew/followers","following_url":"https://api.github.com/users/woodyrew/following{/other_user}","gists_url":"https://api.github.com/users/woodyrew/gists{/gist_id}","starred_url":"https://api.github.com/users/woodyrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woodyrew/subscriptions","organizations_url":"https://api.github.com/users/woodyrew/orgs","repos_url":"https://api.github.com/users/woodyrew/repos","events_url":"https://api.github.com/users/woodyrew/events{/privacy}","received_events_url":"https://api.github.com/users/woodyrew/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/woodyrew/metalsmith-serve","description":null,"fork":true,"url":"https://api.github.com/repos/woodyrew/metalsmith-serve","forks_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/forks","keys_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/keys{/key_id}","collaborators_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/teams","hooks_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/hooks","issue_events_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/issues/events{/number}","events_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/events","assignees_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/assignees{/user}","branches_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/branches{/branch}","tags_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/tags","blobs_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/git/refs{/sha}","trees_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/git/trees{/sha}","statuses_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/statuses/{sha}","languages_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/languages","stargazers_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/stargazers","contributors_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/contributors","subscribers_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/subscribers","subscription_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/subscription","commits_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/commits{/sha}","git_commits_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/git/commits{/sha}","comments_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/comments{/number}","issue_comment_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/issues/comments{/number}","contents_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/contents/{+path}","compare_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/compare/{base}...{head}","merges_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/merges","archive_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/downloads","issues_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/issues{/number}","pulls_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/pulls{/number}","milestones_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/milestones{/number}","notifications_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/labels{/name}","releases_url":"https://api.github.com/repos/woodyrew/metalsmith-serve/releases{/id}","created_at":"2015-09-04T13:47:43Z","updated_at":"2015-09-04T13:47:44Z","pushed_at":"2015-09-04T21:11:42Z","git_url":"git://github.com/woodyrew/metalsmith-serve.git","ssh_url":"git@github.com:woodyrew/metalsmith-serve.git","clone_url":"https://github.com/woodyrew/metalsmith-serve.git","svn_url":"https://github.com/woodyrew/metalsmith-serve","homepage":null,"size":112,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"mayo:master","ref":"master","sha":"d4b476c63c74fb85a9f478f632c5a020fd6759f5","user":{"login":"mayo","id":2772,"avatar_url":"https://avatars.githubusercontent.com/u/2772?v=3","gravatar_id":"","url":"https://api.github.com/users/mayo","html_url":"https://github.com/mayo","followers_url":"https://api.github.com/users/mayo/followers","following_url":"https://api.github.com/users/mayo/following{/other_user}","gists_url":"https://api.github.com/users/mayo/gists{/gist_id}","starred_url":"https://api.github.com/users/mayo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mayo/subscriptions","organizations_url":"https://api.github.com/users/mayo/orgs","repos_url":"https://api.github.com/users/mayo/repos","events_url":"https://api.github.com/users/mayo/events{/privacy}","received_events_url":"https://api.github.com/users/mayo/received_events","type":"User","site_admin":false},"repo":{"id":24748112,"name":"metalsmith-serve","full_name":"mayo/metalsmith-serve","owner":{"login":"mayo","id":2772,"avatar_url":"https://avatars.githubusercontent.com/u/2772?v=3","gravatar_id":"","url":"https://api.github.com/users/mayo","html_url":"https://github.com/mayo","followers_url":"https://api.github.com/users/mayo/followers","following_url":"https://api.github.com/users/mayo/following{/other_user}","gists_url":"https://api.github.com/users/mayo/gists{/gist_id}","starred_url":"https://api.github.com/users/mayo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mayo/subscriptions","organizations_url":"https://api.github.com/users/mayo/orgs","repos_url":"https://api.github.com/users/mayo/repos","events_url":"https://api.github.com/users/mayo/events{/privacy}","received_events_url":"https://api.github.com/users/mayo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mayo/metalsmith-serve","description":null,"fork":false,"url":"https://api.github.com/repos/mayo/metalsmith-serve","forks_url":"https://api.github.com/repos/mayo/metalsmith-serve/forks","keys_url":"https://api.github.com/repos/mayo/metalsmith-serve/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mayo/metalsmith-serve/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mayo/metalsmith-serve/teams","hooks_url":"https://api.github.com/repos/mayo/metalsmith-serve/hooks","issue_events_url":"https://api.github.com/repos/mayo/metalsmith-serve/issues/events{/number}","events_url":"https://api.github.com/repos/mayo/metalsmith-serve/events","assignees_url":"https://api.github.com/repos/mayo/metalsmith-serve/assignees{/user}","branches_url":"https://api.github.com/repos/mayo/metalsmith-serve/branches{/branch}","tags_url":"https://api.github.com/repos/mayo/metalsmith-serve/tags","blobs_url":"https://api.github.com/repos/mayo/metalsmith-serve/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mayo/metalsmith-serve/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mayo/metalsmith-serve/git/refs{/sha}","trees_url":"https://api.github.com/repos/mayo/metalsmith-serve/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mayo/metalsmith-serve/statuses/{sha}","languages_url":"https://api.github.com/repos/mayo/metalsmith-serve/languages","stargazers_url":"https://api.github.com/repos/mayo/metalsmith-serve/stargazers","contributors_url":"https://api.github.com/repos/mayo/metalsmith-serve/contributors","subscribers_url":"https://api.github.com/repos/mayo/metalsmith-serve/subscribers","subscription_url":"https://api.github.com/repos/mayo/metalsmith-serve/subscription","commits_url":"https://api.github.com/repos/mayo/metalsmith-serve/commits{/sha}","git_commits_url":"https://api.github.com/repos/mayo/metalsmith-serve/git/commits{/sha}","comments_url":"https://api.github.com/repos/mayo/metalsmith-serve/comments{/number}","issue_comment_url":"https://api.github.com/repos/mayo/metalsmith-serve/issues/comments{/number}","contents_url":"https://api.github.com/repos/mayo/metalsmith-serve/contents/{+path}","compare_url":"https://api.github.com/repos/mayo/metalsmith-serve/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mayo/metalsmith-serve/merges","archive_url":"https://api.github.com/repos/mayo/metalsmith-serve/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mayo/metalsmith-serve/downloads","issues_url":"https://api.github.com/repos/mayo/metalsmith-serve/issues{/number}","pulls_url":"https://api.github.com/repos/mayo/metalsmith-serve/pulls{/number}","milestones_url":"https://api.github.com/repos/mayo/metalsmith-serve/milestones{/number}","notifications_url":"https://api.github.com/repos/mayo/metalsmith-serve/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mayo/metalsmith-serve/labels{/name}","releases_url":"https://api.github.com/repos/mayo/metalsmith-serve/releases{/id}","created_at":"2014-10-03T05:45:12Z","updated_at":"2015-08-08T08:53:51Z","pushed_at":"2015-09-04T21:16:14Z","git_url":"git://github.com/mayo/metalsmith-serve.git","ssh_url":"git@github.com:mayo/metalsmith-serve.git","clone_url":"https://github.com/mayo/metalsmith-serve.git","svn_url":"https://github.com/mayo/metalsmith-serve","homepage":null,"size":182,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/7"},"html":{"href":"https://github.com/mayo/metalsmith-serve/pull/7"},"issue":{"href":"https://api.github.com/repos/mayo/metalsmith-serve/issues/7"},"comments":{"href":"https://api.github.com/repos/mayo/metalsmith-serve/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mayo/metalsmith-serve/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/mayo/metalsmith-serve/statuses/c9325ccdd12fe4ddd3a14b6800e751fa63e63ca6"}}}}