Shows list api with provides doesn't works
------------------------------------------

                 Key: COUCHDB-1272
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1272
             Project: CouchDB
          Issue Type: Bug
          Components: JavaScript View Server
    Affects Versions: 1.0.3, 1.1
            Reporter: Alexander Shorin


Steps to reproduce:

1. Create show function:
function(doc, req){
  provides('text', function(){
    send('foo, ');
    send('bar, ');
    return 'baz!';
  })
}

2. Make GET request to next resource:
http://localhost:5984/test/_design/foo/_show/send?format=text

3. Response would be 'baz!', but 'foo, bar, baz!' expected.

4. However, show function:
function(doc, req){
    start({'Content-Type': 'text/plain'})
    send('foo, ');
    send('bar, ');
    return 'baz!';
}
will return correct result.

5. And show function:
function(doc, req){
  provides('text', function(){
    send('foo, ');
    send('bar, ');
    send('baz!');
  })
}
will raise an TypeError expection:
{
    error: "render_error"
    reason: "function raised error: (new TypeError("resp is undefined", 
"/usr/share/couchdb/server/main.js", 817)) stacktrace: applyContentType((void 
0),"text/plain; charset=utf-8")@/usr/share/couchdb/server/main.js:817 
runShow(function (doc, req) {provides("text", function () {send("foo, 
");send("bar, ");send("baz!");});},[object Object],[object 
Array])@/usr/share/couchdb/server/main.js:903 (function (doc, req) 
{provides("text", function () {send("foo, ");send("bar, 
");send("baz!");});},[object Object],[object 
Array])@/usr/share/couchdb/server/main.js:991 ("_design/foo",[object 
Array],[object Array])@/usr/share/couchdb/server/main.js:1432 
()@/usr/share/couchdb/server/main.js:1475 
@/usr/share/couchdb/server/main.js:1486 "
}

Both problem functions [1] and [5] works well if they are defined as list 
functions.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to