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

Adding params to the requests #3

Open
mbark opened this issue Feb 19, 2018 · 1 comment
Open

Adding params to the requests #3

mbark opened this issue Feb 19, 2018 · 1 comment

Comments

@mbark
Copy link

mbark commented Feb 19, 2018

I've begun integrating this into our project as it looks like a promising way to cut down repetition for requests (of which there are a considerable amount). One small thing I ran into however was adding params to the requests -- which we do for almost all requests -- which now has to be done with string concatenation. This feels fairly clunky compared to e.g. @angular/http/common which allows passing a map of the params.

What is your opinion on providing a optional key params to the RequestParam type? If you are interested I can see if I can make a PR.

@isaacplmann
Copy link
Owner

Yeah, that sounds like a useful PR. I'd merge that.

If params is undefined use the url without modifications.
If params is defined, then:

  1. Format the keys and values in the params object like this [key]=[value] and join them with an &
    2.a. If the url already has a ?, append the params string with an &
    2.b. If the url does not have a ?, append the params string with a ?

Anything I'm missing?

Tests and documentation are always appreciated.

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

2 participants