req.path and req.requested_path both show the path after rewrites
-----------------------------------------------------------------
Key: COUCHDB-981
URL: https://issues.apache.org/jira/browse/COUCHDB-981
Project: CouchDB
Issue Type: Bug
Components: JavaScript View Server
Affects Versions: 1.1, 1.2
Environment: Ubuntu 9.10 (karmic)
Reporter: Caolan McMahon
The request object passed to show functions contains properties for 'path' and
'requested_path'. Both of these properties return the path *after* rewrites
have taken place, it was my understanding (from talking to benoitc and others
on #couchdb) that requested_path should show the path prior to the rewrite.
With the following design doc:
{
"_id": "_design/test",
"_rev": "1-be48afc903d2ca4b879efa211b354d88",
"shows": {
"testshow": "function(doc, req){log(req); return 'testshow';}"
},
"rewrites": [
{
"from": "/",
"to": "_show/testshow"
}
]
}
Requesting the _rewrite url:
$ curl http://localhost:5984/test/_design/test/_rewrite/
testshow
Shows the following in the couchdb log output:
[info] [<0.592.0>] OS Process #Port<0.2152> Log ::
{"info":{"db_name":"test","doc_count":1,"doc_del_count":0,"update_seq":1,"purge_seq":0,"compact_running":false,"disk_size":4185,"instance_start_time":"1291827724231276","disk_format_version":5,"committed_update_seq":1},"id":null,"uuid":"b37350616734d6a48f6d63fefd00156c","method":"GET","requested_path":["test","_design","test","_show","testshow"],"path":["test","_design","test","_show","testshow"],"query":{},"headers":{"Accept":"*/*","Host":"localhost:5984","User-Agent":"curl/7.19.5
(x86_64-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3
libidn/1.15"},"body":"undefined","peer":"127.0.0.1","form":{},"cookie":{},"userCtx":{"db":"test","name":null,"roles":["_admin"]},"secObj":{}}
[info] [<0.574.0>] 127.0.0.1 - - 'GET' /test/_design/test/_show/testshow 200
You'll notice that both 'path' and 'requested_path' are set to:
["test","_design","test","_show","testshow"]
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.