{"action":"closed","number":81,"pull_request":{"url":"https://api.github.com/repos/cloudant-labs/envoy/pulls/81","id":74736782,"html_url":"https://github.com/cloudant-labs/envoy/pull/81","diff_url":"https://github.com/cloudant-labs/envoy/pull/81.diff","patch_url":"https://github.com/cloudant-labs/envoy/pull/81.patch","issue_url":"https://api.github.com/repos/cloudant-labs/envoy/issues/81","number":81,"state":"closed","locked":false,"title":"prevented ugly 404 errors when unhandled urls are received","user":{"login":"glynnbird","id":697925,"avatar_url":"https://avatars.githubusercontent.com/u/697925?v=3","gravatar_id":"","url":"https://api.github.com/users/glynnbird","html_url":"https://github.com/glynnbird","followers_url":"https://api.github.com/users/glynnbird/followers","following_url":"https://api.github.com/users/glynnbird/following{/other_user}","gists_url":"https://api.github.com/users/glynnbird/gists{/gist_id}","starred_url":"https://api.github.com/users/glynnbird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glynnbird/subscriptions","organizations_url":"https://api.github.com/users/glynnbird/orgs","repos_url":"https://api.github.com/users/glynnbird/repos","events_url":"https://api.github.com/users/glynnbird/events{/privacy}","received_events_url":"https://api.github.com/users/glynnbird/received_events","type":"User","site_admin":false},"body":"I noticed that when I tried to visit an unhandled endpoint e.g. `ccurl /mbaas/_design/bob`, I got a very ugly reply:\r\n\r\n```\r\nError: Not Found<br> &nbsp; &nbsp;at /Users/glynnb/projects/envoy/app.js:57:15<br> &nbsp; &nbsp;at Layer.handle [as handle_request] (/Users/glynnb/projects/envoy/node_modules/express/lib/router/layer.js:95:5)<br> &nbsp; &nbsp;at trim_prefix (/Users/glynnb/projects/envoy/node_modules/express/lib/router/index.js:312:13)<br> &nbsp; &nbsp;at /Users/glynnb/projects/envoy/node_modules/express/lib/router/index.js:280:7<br> &nbsp; &nbsp;at Function.process_params (/Users/glynnb/projects/envoy/node_modules/express/lib/router/index.js:330:12)<br> &nbsp; &nbsp;at Immediate.next (/Users/glynnb/projects/envoy/node_modules/express/lib/router/index.js:271:10)<br> &nbsp; &nbsp;at Immediate.&lt;anonymous&gt; (/Users/glynnb/projects/envoy/node_modules/express/lib/router/index.js:618:15)<br> &nbsp; &nbsp;at Immediate.immediate._onImmediate (timers.js:435:18)<br> &nbsp; &nbsp;at processImmediate [as _immediateCallback] (timers.js:383:17)\r\n```\r\n\r\nI fixed this by simply replying with a 400 (Bad Request) for anything we don't handle and with a JSON response. Also added accompanying test case.","created_at":"2016-06-22T07:36:47Z","updated_at":"2016-06-22T08:00:53Z","closed_at":"2016-06-22T08:00:53Z","merged_at":"2016-06-22T08:00:53Z","merge_commit_sha":"7df5695d19599d9a3cf59b5c47b6a5a33959a734","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudant-labs/envoy/pulls/81/commits","review_comments_url":"https://api.github.com/repos/cloudant-labs/envoy/pulls/81/comments","review_comment_url":"https://api.github.com/repos/cloudant-labs/envoy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudant-labs/envoy/issues/81/comments","statuses_url":"https://api.github.com/repos/cloudant-labs/envoy/statuses/80dfef326fc2f1063299ae2bf840ab9c93fb2e2a","head":{"label":"cloudant-labs:errorhandling","ref":"errorhandling","sha":"80dfef326fc2f1063299ae2bf840ab9c93fb2e2a","user":{"login":"cloudant-labs","id":1815157,"avatar_url":"https://avatars.githubusercontent.com/u/1815157?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant-labs","html_url":"https://github.com/cloudant-labs","followers_url":"https://api.github.com/users/cloudant-labs/followers","following_url":"https://api.github.com/users/cloudant-labs/following{/other_user}","gists_url":"https://api.github.com/users/cloudant-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant-labs/subscriptions","organizations_url":"https://api.github.com/users/cloudant-labs/orgs","repos_url":"https://api.github.com/users/cloudant-labs/repos","events_url":"https://api.github.com/users/cloudant-labs/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":58931747,"name":"envoy","full_name":"cloudant-labs/envoy","owner":{"login":"cloudant-labs","id":1815157,"avatar_url":"https://avatars.githubusercontent.com/u/1815157?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant-labs","html_url":"https://github.com/cloudant-labs","followers_url":"https://api.github.com/users/cloudant-labs/followers","following_url":"https://api.github.com/users/cloudant-labs/following{/other_user}","gists_url":"https://api.github.com/users/cloudant-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant-labs/subscriptions","organizations_url":"https://api.github.com/users/cloudant-labs/orgs","repos_url":"https://api.github.com/users/cloudant-labs/repos","events_url":"https://api.github.com/users/cloudant-labs/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant-labs/envoy","description":"A CouchDB proxy to enable replication of database subsets","fork":false,"url":"https://api.github.com/repos/cloudant-labs/envoy","forks_url":"https://api.github.com/repos/cloudant-labs/envoy/forks","keys_url":"https://api.github.com/repos/cloudant-labs/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant-labs/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant-labs/envoy/teams","hooks_url":"https://api.github.com/repos/cloudant-labs/envoy/hooks","issue_events_url":"https://api.github.com/repos/cloudant-labs/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant-labs/envoy/events","assignees_url":"https://api.github.com/repos/cloudant-labs/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant-labs/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant-labs/envoy/tags","blobs_url":"https://api.github.com/repos/cloudant-labs/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant-labs/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant-labs/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant-labs/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant-labs/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant-labs/envoy/languages","stargazers_url":"https://api.github.com/repos/cloudant-labs/envoy/stargazers","contributors_url":"https://api.github.com/repos/cloudant-labs/envoy/contributors","subscribers_url":"https://api.github.com/repos/cloudant-labs/envoy/subscribers","subscription_url":"https://api.github.com/repos/cloudant-labs/envoy/subscription","commits_url":"https://api.github.com/repos/cloudant-labs/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant-labs/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant-labs/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant-labs/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant-labs/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant-labs/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant-labs/envoy/merges","archive_url":"https://api.github.com/repos/cloudant-labs/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant-labs/envoy/downloads","issues_url":"https://api.github.com/repos/cloudant-labs/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant-labs/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant-labs/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant-labs/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant-labs/envoy/labels{/name}","releases_url":"https://api.github.com/repos/cloudant-labs/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/cloudant-labs/envoy/deployments","created_at":"2016-05-16T12:46:23Z","updated_at":"2016-06-09T00:02:03Z","pushed_at":"2016-06-22T08:00:53Z","git_url":"git://github.com/cloudant-labs/envoy.git","ssh_url":"git@github.com:cloudant-labs/envoy.git","clone_url":"https://github.com/cloudant-labs/envoy.git","svn_url":"https://github.com/cloudant-labs/envoy","homepage":null,"size":242,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":9,"forks":3,"open_issues":9,"watchers":1,"default_branch":"master"}},"base":{"label":"cloudant-labs:master","ref":"master","sha":"447aebe955b9a14c2bfb98b0893707a7cfe0863f","user":{"login":"cloudant-labs","id":1815157,"avatar_url":"https://avatars.githubusercontent.com/u/1815157?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant-labs","html_url":"https://github.com/cloudant-labs","followers_url":"https://api.github.com/users/cloudant-labs/followers","following_url":"https://api.github.com/users/cloudant-labs/following{/other_user}","gists_url":"https://api.github.com/users/cloudant-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant-labs/subscriptions","organizations_url":"https://api.github.com/users/cloudant-labs/orgs","repos_url":"https://api.github.com/users/cloudant-labs/repos","events_url":"https://api.github.com/users/cloudant-labs/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":58931747,"name":"envoy","full_name":"cloudant-labs/envoy","owner":{"login":"cloudant-labs","id":1815157,"avatar_url":"https://avatars.githubusercontent.com/u/1815157?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant-labs","html_url":"https://github.com/cloudant-labs","followers_url":"https://api.github.com/users/cloudant-labs/followers","following_url":"https://api.github.com/users/cloudant-labs/following{/other_user}","gists_url":"https://api.github.com/users/cloudant-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant-labs/subscriptions","organizations_url":"https://api.github.com/users/cloudant-labs/orgs","repos_url":"https://api.github.com/users/cloudant-labs/repos","events_url":"https://api.github.com/users/cloudant-labs/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant-labs/envoy","description":"A CouchDB proxy to enable replication of database subsets","fork":false,"url":"https://api.github.com/repos/cloudant-labs/envoy","forks_url":"https://api.github.com/repos/cloudant-labs/envoy/forks","keys_url":"https://api.github.com/repos/cloudant-labs/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant-labs/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant-labs/envoy/teams","hooks_url":"https://api.github.com/repos/cloudant-labs/envoy/hooks","issue_events_url":"https://api.github.com/repos/cloudant-labs/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant-labs/envoy/events","assignees_url":"https://api.github.com/repos/cloudant-labs/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant-labs/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant-labs/envoy/tags","blobs_url":"https://api.github.com/repos/cloudant-labs/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant-labs/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant-labs/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant-labs/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant-labs/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant-labs/envoy/languages","stargazers_url":"https://api.github.com/repos/cloudant-labs/envoy/stargazers","contributors_url":"https://api.github.com/repos/cloudant-labs/envoy/contributors","subscribers_url":"https://api.github.com/repos/cloudant-labs/envoy/subscribers","subscription_url":"https://api.github.com/repos/cloudant-labs/envoy/subscription","commits_url":"https://api.github.com/repos/cloudant-labs/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant-labs/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant-labs/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant-labs/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant-labs/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant-labs/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant-labs/envoy/merges","archive_url":"https://api.github.com/repos/cloudant-labs/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant-labs/envoy/downloads","issues_url":"https://api.github.com/repos/cloudant-labs/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant-labs/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant-labs/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant-labs/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant-labs/envoy/labels{/name}","releases_url":"https://api.github.com/repos/cloudant-labs/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/cloudant-labs/envoy/deployments","created_at":"2016-05-16T12:46:23Z","updated_at":"2016-06-09T00:02:03Z","pushed_at":"2016-06-22T08:00:53Z","git_url":"git://github.com/cloudant-labs/envoy.git","ssh_url":"git@github.com:cloudant-labs/envoy.git","clone_url":"https://github.com/cloudant-labs/envoy.git","svn_url":"https://github.com/cloudant-labs/envoy","homepage":null,"size":242,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":9,"forks":3,"open_issues":9,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudant-labs/envoy/pulls/81"},"html":{"href":"https://github.com/cloudant-labs/envoy/pull/81"},"issue":{"href":"https://api.github.com/repos/cloudant-labs/envoy/issues/81"},"comments":{"href":"https://api.github.com/repos/cloudant-labs/envoy/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudant-labs/envoy/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudant-labs/envoy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudant-labs/envoy/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/cloudant-labs/envoy/statuses/80dfef326fc2f1063299ae2bf840ab9c93fb2e2a"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"xpqz","id":2690852,"avatar_url":"https://avatars.githubusercontent.com/u/2690852?v=3","gravatar_id":"","url":"https://api.github.com/users/xpqz","html_url":"https://github.com/xpqz","followers_url":"https://api.github.com/users/xpqz/followers","following_url":"https://api.github.com/users/xpqz/following{/other_user}","gists_url":"https://api.github.com/users/xpqz/gists{/gist_id}","starred_url":"https://api.github.com/users/xpqz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xpqz/subscriptions","organizations_url":"https://api.github.com/users/xpqz/orgs","repos_url":"https://api.github.com/users/xpqz/repos","events_url":"https://api.github.com/users/xpqz/events{/privacy}","received_events_url":"https://api.github.com/users/xpqz/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"commits":1,"additions":38,"deletions":6,"changed_files":2}}
{"actor":{"display_login":"xpqz"}}