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

respondWith() called after getRow() does not set "Content-Type" response

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.10
    • Fix Version/s: 1.4.0
    • Component/s: JavaScript View Server
    • Labels:
      None
    • Environment:
      {"couchdb":"Welcome","version":"0.10.0a796218"}

      Linux

    • Skill Level:
      Regular Contributors Level (Easy to Medium)

      Description

      After calling getRow() once, the response header are locked and cannot be changed by respondWith.
      getRow() should be side-effect free and Sending shouldn't start before calling send();

      Example, where respondWith() cannot set "Content-Type" response header according to "Accept" request header:

      function(head, req){
      var row = getRow();
      respondWith(req,
      {
      json : function() {
      send("

      {'json'}

      ");
      },
      xml : function()

      { send('<?xml version="1.0" encoding="UTF-8"?>'); }

      });
      }

        Attachments

        1. 20121106_github_pr_18.diff
          7 kB
          Dave Cottlehuber

          Issue Links

            Activity

              People

              • Assignee:
                dch Dave Cottlehuber
                Reporter:
                rsl Rune S. Larsen
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: