From dbf44bf06de86c3f5cb3e649c5114ef5d91c1c3c Mon Sep 17 00:00:00 2001 From: Aiko Mastboom Date: Tue, 30 Dec 2014 13:51:07 +0100 Subject: [PATCH] use express content-type helper --- lib/responder.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/responder.js b/lib/responder.js index 2c6d965..821d985 100644 --- a/lib/responder.js +++ b/lib/responder.js @@ -17,8 +17,13 @@ module.exports = function (options, res, next) { if (options.attribute) { content = result[options.attribute]; } - // Set _Content-Type_ response header with `type` through `mime.lookup()` - res.type(options.ext); + if (options.ext) { + // Set _Content-Type_ response header with `type` through `mime.lookup()` + res.type(options.ext); + } else { + res.type('text/plain'); + } + return res.send(content); }; };