shiki/kaiseki — pull request #17 by adamloving (2013-12-30 20:08:52+00:00)
Title: Check for undefined content type

Unfortunately, I don't have the exact repro steps, but in a production environment where I use kaiseki, sometimes res.headers['content-type'] is undefined. This commit adds a check for the content type header.

The fix is for this error (I was using an older version in production, so the line number was off):

2013-12-29T15:37:11.201Z - error: uncaughtException message=Cannot call method 'toLowerCase' of undefined, stack=TypeError: Cannot call method 'toLowerCase' of undefined

at Request._callback (/home/appuser/projects/rest-api/node_modules/kaiseki/lib/kaiseki.js:322:46)
at Request.self.callback (/home/appuser/projects/rest-api/node_modules/kaiseki/node_modules/request/request.js:129:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request. (/home/appuser/projects/rest-api/node_modules/kaiseki/node_modules/request/request.js:873:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage. (/home/appuser/projects/rest-api/node_modules/kaiseki/node_modules/request/request.js:824:12)