Sure enough, it worked! ~ $ curl -i localhost:5984/db/_design/ddoc/_list/test-redirect/viewname?key=%22foo%22 HTTP/1.1 301 Moved Permanently Vary: Accept Transfer-Encoding: chunked Server: CouchDB/0.11.0a9fd42dc1-git (Erlang OTP/R12B) Location: http://www.google.com/ Etag: "BD2ANSRT6L22UMHH33LRICKXI" Date: Fri, 25 Sep 2009 15:15:13 GMT Content-Type: application/json
Thanks for all the help, guys! Shall I delete that JIRA issue? On Fri, Sep 25, 2009 at 10:12 AM, Jason Davies <[email protected]> wrote: > Hi Zach, > > Try this instead: > > function(head, req) { > start({code:301, headers: { 'Location': 'http://www.google.com/' }}); > } > > Thanks, > -- > Jason Davies > > www.jasondavies.com > > On 24 Sep 2009, at 23:34, Zachary Zolton wrote: > >> Hello, >> >> Should I be able to do a redirect from a _list function? >> >> I ask because I've tried defining the following _list function: >> >> function(head, req) { >> return { >> 'code': 301, >> 'headers': { 'Location': 'http://www.google.com/' } >> }; >> } >> >> And, here's what happens when I try to hit it: >> >> $ curl -i >> 'http://localhost:5984/db/_design/ddoc/_list/test-redirect/some-view?key=%22foo%22' >> HTTP/1.1 200 OK >> Vary: Accept >> Transfer-Encoding: chunked >> Server: CouchDB/0.11.0a9fd42dc1-git (Erlang OTP/R12B) >> Etag: "46014W5JDRLKZF5SECP2D44YH" >> Date: Thu, 24 Sep 2009 22:23:14 GMT >> Content-Type: application/json >> >> curl: (56) Received problem 2 in the chunky parser >> >> Obviously, this does not look like a redirect. :^( Do I seem to be >> doing anything wrong here? >> >> >> Thanks! >> >> Zach > >
