(node:29516) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'indexOf' of undefined
at logRequest (/home/v3rse/TheFactory/code/learn/javascript/playground/frameworks/micro/hello-micro/node_modules/micro-dev/lib/log.js:38:71)
at initLog (/home/v3rse/TheFactory/code/learn/javascript/playground/frameworks/micro/hello-micro/node_modules/micro-dev/lib/log.js:97:23)
at /home/v3rse/TheFactory/code/learn/javascript/playground/frameworks/micro/hello-micro/node_modules/micro-dev/lib/log.js:123:2
at resolve (/home/v3rse/TheFactory/code/learn/javascript/playground/frameworks/micro/hello-micro/node_modules/micro/lib/index.js:96:33)
at new Promise (<anonymous>)
at Function.exports.run (/home/v3rse/TheFactory/code/learn/javascript/playground/frameworks/micro/hello-micro/node_modules/micro/lib/index.js:96:2)
at Server.server (/home/v3rse/TheFactory/code/learn/javascript/playground/frameworks/micro/hello-micro/node_modules/micro/lib/index.js:13:50)
at emitTwo (events.js:126:13)
at Server.emit (events.js:214:7)
at parserOnIncoming (_http_server.js:656:12)
(node:29516) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:29516) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 2)
Issue summary
micro-dev throws the following:
From what I can tell this happens on the following line when a
content-type
is not sent in the header: https://github.com/zeit/micro-dev/blob/7ea8ae05a56fa76788bed6fc9ee2d38728e0eac6/lib/log.js#L38How to reproduced:
micro
projectmicro-dev
localhost:3000
without setting acontent-type
header{ "test": "some-data" }