Query Params
fgavilan-stratio opened this issue · comments
Hi, from the documentation of Dyson, I can see that it's supposed to process query params, as in
http://localhost/endpoint?query=params
I need my mockup server to be capable of processing this query=params segment. I searched all the internet up and down to no avail. This is my export:
module.exports = {
path: '/object/endpoint?:filters',
collection: true,
method: 'GET',
cache: false,
template: () => {
return {
params: (params) => params,
query: (query) => query,
};
}
}
When I do a GET to http://localhost:3000/object/endpoint?variable=value, this is the response:
{
"params":
{
"filters": "s"
},
"query":
{
"filters": "s"
}
}
If I dont include the query params bit in the URL, the result is the same. Is there anything I can do to get something like:
{
"params":
{
"query": "variable=value"
}
}
at least?
The first argument provides "param", even if it is called query
. The second argument provides the "query". So it should be something like this:
params: (params) => params,
query: (params, query) => query,