forwardemail / forwardemail/superagent
Filtering query with query method
- Dominant language
- JavaScript
- Stars
- 16.6k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
I´m creating a small Node.js application which calls some REST api´s using Superagent (v. 5.1.2). I need to send a filter option with a get request.
The API endpoint needs the following structure:
endpoint-url/test?filter=_name eq 'testname'
I´m struggling to achieve this result using superagent with the built-in query method. When I send the request I´ll get all items returned, so the filter option isn´t making any effect. Once I test it via postman I´ll get just the specified item returned with the _name = 'testname'. The variable name down in the code has the value 'testname'.
Here is my code snippet
`superagent.get('endpoint-url/test').authBearer(token).query({'filter': '_name eq ' + name})
.then(res => {...}).catch(err => {...});`
Contributor guide
Assessment
This issue has not been assessed yet.