From dev-return-21070-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Fri Feb 24 23:54:13 2012 Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 932A890CA for ; Fri, 24 Feb 2012 23:54:13 +0000 (UTC) Received: (qmail 64035 invoked by uid 500); 24 Feb 2012 23:54:13 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 63982 invoked by uid 500); 24 Feb 2012 23:54:12 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 63970 invoked by uid 99); 24 Feb 2012 23:54:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2012 23:54:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2012 23:54:09 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id BD005339C92 for ; Fri, 24 Feb 2012 23:53:48 +0000 (UTC) Date: Fri, 24 Feb 2012 23:53:48 +0000 (UTC) From: "Alexander Shorin (Commented) (JIRA)" To: dev@couchdb.apache.org Message-ID: <917798940.17892.1330127628775.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1864263823.53750.1320281372473.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (COUCHDB-1330) provides() does not supports returning a status code or headers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COUCHDB-1330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216133#comment-13216133 ] Alexander Shorin commented on COUCHDB-1330: ------------------------------------------- Oops, it looks like I'd break some things...My position was that provides functions are operates with data level, providing specific handler for requested content-type, while headers/status code is metadata that should be determent early. However, @Nathan right, there could be {"json": ...} body definition and also {"base64": ...} that processed behind of scene at CouchDB side. Mixing them better to count as unexpectable result due to it depends on key order in json response from query server. However, there is possible case for data collision: function (doc, req) { provides('html', function () { return { headers: { Location: 'http://www.iriscouch.com' }, code: 302, json: {status: 'redirecting', message: 'We will take you with us to IrisCouch!'} }; }); return { code: 404, headers: {"X-Couch-Reponse": "Relax!"} json: {error: 'not_a_chance', reason: "I'm tired, leave me alone!"} } } What is expected output? 404 and error message or 302 and redirect? Should headers be merged or provided_resp one only wins? IMHO, provided_resp should override all resp data, except in case of chunked response when resp.body = resp.chunks + resp.body + provided_resp.chunks + provided_resp.body. If nobody stand against those terms I'll update patch to follow described behavior. > provides() does not supports returning a status code or headers > --------------------------------------------------------------- > > Key: COUCHDB-1330 > URL: https://issues.apache.org/jira/browse/COUCHDB-1330 > Project: CouchDB > Issue Type: Bug > Components: JavaScript View Server > Affects Versions: 1.1.1 > Environment: Iris Couch > Reporter: Jason Smith > Priority: Minor > Attachments: A_0001-Support-provides-callbacks-indicating-status-code-an.patch > > Original Estimate: 4h > Remaining Estimate: 4h > > An Iris Couch user lost the ability to redirect from a provides() callback in a show function: http://getsatisfaction.com/iriscouch/topics/_provides_method_not_returning_code_and_headers > This show function no longer works: > function (doc, req) { > provides('html', function () { > return { > headers: { Location: 'http://www.iriscouch.com' }, > code: 302, > body: 'Redirecting to IrisCouch website...' > }; > }); > } > This looks like a regression from 1.1.0; although there are no unit tests so perhaps strictly speaking it was unsupported functionality. Git bisect places the error at the patch to COUCHDB-1272. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira