{"action":"opened","issue":{"url":"https://api.github.com/repos/xebia/mock-rest-request/issues/6","repository_url":"https://api.github.com/repos/xebia/mock-rest-request","labels_url":"https://api.github.com/repos/xebia/mock-rest-request/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/xebia/mock-rest-request/issues/6/comments","events_url":"https://api.github.com/repos/xebia/mock-rest-request/issues/6/events","html_url":"https://github.com/xebia/mock-rest-request/issues/6","id":136880128,"number":6,"title":"Server crashes (sometimes) when unregistered endpoint requested","user":{"login":"tommcintyre","id":5124538,"avatar_url":"https://avatars.githubusercontent.com/u/5124538?v=3","gravatar_id":"","url":"https://api.github.com/users/tommcintyre","html_url":"https://github.com/tommcintyre","followers_url":"https://api.github.com/users/tommcintyre/followers","following_url":"https://api.github.com/users/tommcintyre/following{/other_user}","gists_url":"https://api.github.com/users/tommcintyre/gists{/gist_id}","starred_url":"https://api.github.com/users/tommcintyre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommcintyre/subscriptions","organizations_url":"https://api.github.com/users/tommcintyre/orgs","repos_url":"https://api.github.com/users/tommcintyre/repos","events_url":"https://api.github.com/users/tommcintyre/events{/privacy}","received_events_url":"https://api.github.com/users/tommcintyre/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-27T05:10:47Z","updated_at":"2016-02-27T05:10:47Z","closed_at":null,"body":"When my application requests an unregistered endpoint, the mock server crashes:\r\n\r\n```\r\npath/to/mock-server/node_modules/mock-rest-request/index.js:60\r\n        next();\r\n        ^\r\n\r\nTypeError: next is not a function\r\n    at path/to/mock-server/node_modules/mock-rest-request/index.js:60:9\r\n    at Server.<anonymous> (path/to/mock-server/app.js:8:17)\r\n    at emitTwo (events.js:100:13)\r\n    at Server.emit (events.js:185:7)\r\n    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:537:12)\r\n    at HTTPParser.parserOnHeadersComplete (_http_common.js:103:23)\r\n\r\n[1]+  Exit 1                  node app.js\r\n```\r\n\r\nThe mock server doesn't crash when I request an unregistered endpoint using curl; only when called from my app, which uses [restling](https://www.npmjs.com/package/restling). Perhaps restling closes the connection down more quickly than curl, or something...?\r\n"}}