Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-1272

Shows list api with provides doesn't works

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0.3, 1.1
    • 1.1.1, 1.2
    • JavaScript View Server
    • None

    Description

      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.

      Attachments

        1. render.patch
          3 kB
          Alexander Shorin

        Activity

          People

            jan Jan Lehnardt
            kxepal Alexander Shorin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: