IIRC, this would require a change in the view server protocol.
Here's the prior discussion of making the change:
https://issues.apache.org/jira/browse/COUCHDB-514
On Tue, Nov 30, 2010 at 12:58 AM, Paul Davis
<paul.joseph.davis@gmail.com> wrote:
> On Tue, Nov 30, 2010 at 1:51 AM, Aurélien Bénel <aurelien.benel@utt.fr> wrote:
>> Thanks for your answer, Paul.
>>
>>> Unfortunately, the current list behaviour doesn't allow you to modify response
headers after calling getRow().
>>
>>
>> Oh, too bad...
>> Is there a plan to change this behaviour?
>>
>
> There have been suggestions to changing that API. I would currently
> rate the timescale for such a change on the order of months to a year.
> Definitely no discussions have suggested anything in the next couple
> releases.
>
> Although, an interested developer that provided patches might be able
> to seriously contract that timeline ;)
>
> HTH,
> Paul Davis
>
>>
>> Aurélien
>>
>>
>>>> I'm trying to send a redirect from a list with the following code:
>>>>
>>>> function (head, req) {
>>>> var row = getRow();
>>>> if (row) {
>>>> var url = "/"; // Will be computed from row
>>>> return {"code": 302, "headers":{ "Location": url}};
>>>> } else {
>>>> return({"code": 404, "body": "Not here"});
>>>> }
>>>> }
>>
>
|