You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: I do not have anything to do with this project, I'm just a user.
Anyway judging by the code (see below) I am not sure if there is much that you can do. The code just logs the error using console.warn() and then returns with 500 status. I would have expected try/catch to work actually... should try it out!
I think that if you want some custom behaviour you will have to either make a PR or a fork. The last commit was in August 2016 so I am not sure if any PRs will get merged, but let's see. ;)
if(matchIndex===null){if(self._throwOnUnmatched){thrownewError('No Match For: '+req.method+' '+req.url);}console.error('No Match For: '+req.method+' '+req.url);if(req.method==='PUT'||req.method==='PATCH'||req.method==='POST'){console.error(req.body);}res.writeHead(500,{'Content-Type': 'text/plain'});res.end('No Matching Response!\n');}else{if(self._assertions[matchIndex].sendResponse(res)){self._assertions.splice(matchIndex,1)[0];}}
Hock server now fails on unmatched urls by default. How can I set my own behaviour for that?
I know about "throwOnUnmatched" option, but it makes server to respond with "500" status, and it's not what I want.
I've tried
server.on("error"
, andtry/catch
, but it's not workedThe text was updated successfully, but these errors were encountered: