diff options
-rw-r--r-- | share/server/main.js | 4 | ||||
-rw-r--r-- | src/couchdb/couch_httpd_view.erl | 3 |
2 files changed, 6 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) { diff --git a/src/couchdb/couch_httpd_view.erl b/src/couchdb/couch_httpd_view.erl index fc3302d7..7666da98 100644 --- a/src/couchdb/couch_httpd_view.erl +++ b/src/couchdb/couch_httpd_view.erl @@ -328,6 +328,9 @@ parse_view_query(Req, Keys, IsReduce) -> Msg1 = "Bad URL query value for 'include_docs' expected \"true\" or \"false\".", throw({query_parse_error, Msg1}) end; + {"format", _} -> + % we just ignore format, so that JS can have it + Args; _ -> % unknown key Msg = lists:flatten(io_lib:format( "Bad URL query key:~s", [Key])), |