[
https://issues.apache.org/jira/browse/COUCHDB-898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12932938#action_12932938
]
Jan Lehnardt commented on COUCHDB-898:
--------------------------------------
I tried testing it with this:
// test the provides mime matcher with long mime type names
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/
headers: {
"Accept": 'text/html,application/atom+xml; q=0.9'
}
});
var ct = xhr.getResponseHeader("Content-Type");
T(/charset=utf-8/.test(ct))
T(/text\/html/.test(ct))
T(xhr.responseText == "Ha ha, you said \"plankton\".");
but I got errors:
[error] [<0.1349.0>] OS Process Error <0.1554.0> :: {<<"render_error">>,
<<"function raised error: (new
TypeError(\"weighted[weighted.length - 1] is undefined\",
\"/Users/jan/Work/couchdb-git/share/server/main.js\", 661)) \nstacktrace:
([object
Array],\"text/html\")@/Users/jan/Work/couchdb-git/share/server/main.js:661\nrunProvides([object
Object])@/Users/jan/Work/couchdb-git/share/server/main.js:763\nrunShow((function
(doc, req) {provides(\"text/html\", function () {return \"Ha ha, you said
\\\"\" + doc.word + \"\\\".\";});}),[object Object],[object
Array])@/Users/jan/Work/couchdb-git/share/server/main.js:917\n((function (doc,
req) {provides(\"text/html\", function () {return \"Ha ha, you said \\\"\" +
doc.word + \"\\\".\";});}),[object Object],[object
Array])@/Users/jan/Work/couchdb-git/share/server/main.js:1006\n(\"_design/template\",[object
Array],[object
Array])@/Users/jan/Work/couchdb-git/share/server/main.js:1437\n()@/Users/jan/Work/couchdb-git/share/server/main.js:1480\n@/Users/jan/Work/couchdb-git/share/server/main.js:1491\n">>}
[info] [<0.1349.0>] 127.0.0.1 - - 'GET'
/test_suite_db/_design/template/_show/provides-long/a90378d7be8a4f50df172ad66407a4ad
500
> Allow provides() to handle "raw" MIME Type declarations as well as "shortcut"
> names
> -----------------------------------------------------------------------------------
>
> Key: COUCHDB-898
> URL: https://issues.apache.org/jira/browse/COUCHDB-898
> Project: CouchDB
> Issue Type: Improvement
> Components: JavaScript View Server
> Affects Versions: 1.0.1
> Reporter: Benjamin Young
> Priority: Minor
> Fix For: 1.0.2
>
> Attachments: provides_reverse_content_type_lookup.diff
>
>
> Right now, provides() only supports the content types declared via
> registerType() if they're selected using the shortcut names used in main.js
> (or render.js in trunk). Without a list of those "laying around" a developer
> will likely submit a raw MIME Type vs. using the shortcut name.
> For example,
> provides("text/calendar", ....);
> currently fails because you need to use:
> provides("ics", ....);
> More people know about "text/calendar" than will know to guess the shortcut
> name.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.