diff options
author | John Christopher Anderson <jchris@apache.org> | 2009-02-09 00:57:26 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2009-02-09 00:57:26 +0000 |
commit | 3d5351adb31fea59400179f85fb2dd97b7028ddb (patch) | |
tree | fec90683ec159379d77401d7ce7c274a81a5c83d /share/server | |
parent | 58e040359fa8d175b9eecec49f58e3dd00c78d1e (diff) |
allow format query param to override accept headers for _list and _show
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@742217 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/server')
-rw-r--r-- | share/server/main.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/share/server/main.js b/share/server/main.js index 2bbf1638..13e85ed8 100644 --- a/share/server/main.js +++ b/share/server/main.js @@ -142,7 +142,7 @@ var Mimeparse = (function() { // this function provides a shortcut for managing responses by Accept header respondWith = function(req, responders) { var bestKey = null, accept = req.headers["Accept"]; - if (accept) { + if (accept && !req.query.format) { var provides = []; for (key in responders) { if (mimesByKey[key]) { @@ -151,6 +151,8 @@ respondWith = function(req, responders) { } var bestMime = Mimeparse.bestMatch(provides, accept); bestKey = keysByMime[bestMime]; + } else { + bestKey = req.query.format; } var rFunc = responders[bestKey || responders.fallback || "html"]; if (rFunc) { |