Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't replace url params from http request query #51

Open
egehandulger opened this issue Jul 15, 2020 · 0 comments
Open

Can't replace url params from http request query #51

egehandulger opened this issue Jul 15, 2020 · 0 comments

Comments

@egehandulger
Copy link

egehandulger commented Jul 15, 2020

As far as I understand right now it is possible to insert query parameters via defining them as params within proxy.

app.use('/api/test', requestProxy({
  url: `${services.forecast.baseUrl}/something/:something`,
  query: {
    apikey: services.forecast.apiKey,
  },
  params: {
    something: 123,
  },
}))

I was looking into replacing this within the axios call.

const fetchSomethingForecast = (something) => call(
    axios,
    {
      method: 'get',
      url: '/api/test',
      params: {
        something: something,
      },
    }
  )

However, axios params go into req.query and hence the url parameter is not replaced.
My suggestion would be to consider query parameters as well while compiling the path in this line. Or do you think that this would be a performance issue?

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

No branches or pull requests

1 participant