Req is missing inside a _list function

## Expected Behavior
I'm using "req" inside a function stored in _list.
It worked perfectly until recently (and I cannot reproduce locally with an 
older version of CouchDB).

## Current Behavior
error: "render_error"
reason:"function raised error: (new TypeError("req.query is undefined", 
"lists.schools", 5))

Here is school.js inside _list:
```
function(head, req) {

    req = req || {};   // odd bug
    req.query = req.query || {};   // odd bug
    var callback = req.query.callback || null;
```
I've added the two first lines hoping it will fix the bug, but it has not.  :(
req.query comes from a rewrite.
```
    { "from": "portal/api/guest/schools/:schoolid", "to": 
"_list/schools/allschools",
                "query": { "callback": "os_guest_domaintest", "access": "all" } 
},
```

## Possible Solution
No idea.

## Steps to Reproduce (for bugs)
Go to www.omniscol.com
Enter a school name, go to the next field: It triggers a verification (that the 
requested domain is not already taken). Sometimes it works. Sometimes it fails 
(500 answer. With all my backend code in the error field...).


## Your Environment
* Version used: 2.1.2 and 2.2 (but not 2.1.1)
* Browser Name and version: Chrome
* Operating System and version (desktop or mobile): MacOS X


[ Full content available at: https://github.com/apache/couchdb/issues/1583 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to