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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.10
    • 1.4.0
    • JavaScript View Server
    • None
    • {"couchdb":"Welcome","version":"0.10.0a796218"}

      Linux

    • 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

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

              Dates

                Created:
                Updated:
                Resolved: