CouchDB
  1. CouchDB
  2. COUCHDB-648

_update handler ignores "code" in response doc

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.1, 1.2
    • Component/s: Database Core
    • Labels:
    • Environment:

      CouchDB from HEAD

    • Skill Level:
      New Contributors Level (Easy)

      Description

      When using an _update handler, it should be possible to return a response code.

      return [ doc, {
      headers :

      { "Location" : "/" }

      ,
      code : 303,
      body : 'Redirecting'
      }];

      Should return 303 (the redirect for POST) but in fact, on a successful create returns 201. This means it is not possible to use the browser to POST as you cannot redirect on return. This feels like a bug.

      In any case, I would respectfully suggest that the syntax of the _update handler be changed so that there is a store(doc) call (or similar) which returns a JSON object to the update handler so that the handler may redirect appropriately. That would make it possible to do updates client-side with little or no client-side javascript.

      1. test.diff
        1 kB
        Christian Carter
      2. 0001-Document-update-handlers-now-honor-code-in-response-.patch
        1 kB
        Jonathan D. Knezek

        Issue Links

          Activity

          Cliff Stanford created issue -
          Paul Joseph Davis made changes -
          Field Original Value New Value
          Skill Level New Contributors Level (Easy)
          Jonathan D. Knezek made changes -
          Christian Carter made changes -
          Attachment test.diff [ 12484851 ]
          Christian Carter made changes -
          Comment [ Test ]
          Marcos Zanona made changes -
          Comment [ More than one year this post was created. Any progress on that?
          ]
          Randall Leeds made changes -
          Assignee Randall Leeds [ tilgovi ]
          Benjamin Young made changes -
          Link This issue is duplicated by COUCHDB-990 [ COUCHDB-990 ]
          Randall Leeds made changes -
          Fix Version/s 1.1.1 [ 12316395 ]
          Fix Version/s 1.2 [ 12315198 ]
          Randall Leeds made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              Randall Leeds
              Reporter:
              Cliff Stanford
            • Votes:
              11 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development