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

Recognizing routes with queryParams #53

Open
CamonZ opened this issue May 4, 2015 · 11 comments
Open

Recognizing routes with queryParams #53

CamonZ opened this issue May 4, 2015 · 11 comments

Comments

@CamonZ
Copy link

CamonZ commented May 4, 2015

Hi, over at @stackbuilders/all we're using route-recognizer as part of pretender.js to test an Ember app.

We have a complex scenario we're we are calling a backend endpoint with different query params to get a filtered collection of items leaving us with very complex test code where we map the params to what the responses should be.

From looking at the code of the library you guys are already adding the endpoint with the query params but when recognizing it you guys are dropping the query params leaving the recognize without viable solutions because it can't find any handlers for the route without the query params

Is this the intended behaviour, would making a patch for it to match the url with the queryParams make sense to you?

EDIT: Updated the code references to v0.1.9 which was the version used at the time I reported this.

@jamesplease
Copy link
Contributor

Ref: UI-Router's implementation.

@jamesplease
Copy link
Contributor

jamesplease commented Apr 14, 2016

@CamonZ can you share some code, or a failing test case? Curious to learn more about this use case.

@nathanhammond
Copy link
Contributor

Failing test as an Ember app: https://github.com/nathanhammond/rrtest-app

@lcoq
Copy link

lcoq commented Dec 7, 2016

Is there any update on this issue ?

I encounter the same problem while using pretender.js : I'd like to use different stubs for the same route but different query parameters with no luck.

@CamonZ
Copy link
Author

CamonZ commented Dec 7, 2016

@jmeas it's been a while, I'd have to dig, and see if I have the failing code somewhere.

From my original description, it looks like the issue was that

  • /foo?bar=baz
  • /foo?quux=fgs

Were both being recognized simply as: /foo.

@lcoq
Copy link

lcoq commented Dec 7, 2016

@CamonZ @jmeas : @nathanhammond wrote a failing test as an Ember app few comments above, not sure if this is still relevant.

Anyway, I did not dig into the route-recognizer source code, but my use case with Pretender is the following :

When I try to stub a request on Pretender.js which includes query params (see code below), the request is not handled :

server.get('foo?bar=baz', /* ... */);

From what is said on this Pretender issue, Pretender needs some changes on route-recognizer to resolve this use case.

@raido
Copy link

raido commented Dec 15, 2016

I just got into this trap. This either needs to be supported or clearly documented under some sort of caveats section.

@patocallaghan
Copy link

I've also just come across this issue while trying to use Pretender.js with query params in my URL. Was there any progress made on a fix or is there anything that I can do to help it along?

@eddie-ruva
Copy link

I came across this issue recently too while working with Pretender. I would be happy to move this forward with a PR but wanted to ask if this is something that would be ok for route recognizer to support before doing the work?

@mattdonnelly
Copy link

Bumping this as I've also encountered it while using Pretender.js. Is there any update on this?

@ro0gr
Copy link

ro0gr commented May 31, 2018

I feel query params should not be a part of a route definition. At least I can't recall any MVC Framework which allows you to map routes to something other than URL pathname.

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

9 participants