diff options
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | share/server/render.js | 8 |
2 files changed, 5 insertions, 4 deletions
@@ -76,5 +76,6 @@ suggesting improvements or submitting changes. Some of these people are: * Gabriel Farrell <gsf747@gmail.com> * Mike Leddy <mike@loop.com.br> * Felix Hummel <apache@felixhummel.de> + * Tim Smith <tim@couchbase.com> For a list of authors see the `AUTHORS` file. diff --git a/share/server/render.js b/share/server/render.js index 9dcfbcd6..d207db41 100644 --- a/share/server/render.js +++ b/share/server/render.js @@ -72,7 +72,7 @@ var Mime = (function() { Mime.responseContentType = null; }; - function runProvides(req) { + function runProvides(req, ddoc) { var supportedMimes = [], bestFun, bestKey = null, accept = req.headers["Accept"]; if (req.query && req.query.format) { bestKey = req.query.format; @@ -103,7 +103,7 @@ var Mime = (function() { }; if (bestFun) { - return bestFun(); + return bestFun.call(ddoc); } else { var supportedTypes = mimeFuns.map(function(mf) {return mimesByKey[mf[0]].join(', ') || mf[0]}); throw(["error","not_acceptable", @@ -233,7 +233,7 @@ var Render = (function() { } if (Mime.providesUsed) { - resp = Mime.runProvides(args[1]); + resp = Mime.runProvides(args[1], ddoc); resp = applyContentType(maybeWrapResponse(resp), Mime.responseContentType); } @@ -287,7 +287,7 @@ var Render = (function() { var tail = listFun.apply(ddoc, args); if (Mime.providesUsed) { - tail = Mime.runProvides(req); + tail = Mime.runProvides(req, ddoc); } if (!gotRow) getRow(); if (typeof tail != "undefined") { |