Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Query Params #112

Closed
fgavilan-stratio opened this issue Sep 6, 2021 · 2 comments
Closed

Query Params #112

fgavilan-stratio opened this issue Sep 6, 2021 · 2 comments

Comments

@fgavilan-stratio
Copy link

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?

@webpro
Copy link
Owner

webpro commented Sep 6, 2021

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,

@fgavilan-stratio
Copy link
Author

fgavilan-stratio commented Sep 6, 2021 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants