question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Route matching doesn't handle `%2F` (encoded `/`) as expected

See original GitHub issue

Current behavior:

cy.route('api/issue*') doesn’t match XHR request sent to api/issue?param=%2Fpath%2Fto (where param value is encodeURIComponent('/path/to')).

Desired behavior:

Properly encoded / symbol (as %2F) will not be treated as a path separator by the cy.route command.

Test code to reproduce

See ikornienko/cypress-route-issue-repro.

Versions

Cypress 4.4.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
ikornienkocommented, Apr 22, 2020

For anyone who stumbles upon it: to match a request with any query params to the route /api/issue (like /api/issue?param=plain and /api/issue?param=%2Fpath%2Fto%2Fsomething) you can pass to cy.route this one: /api/issue\\?{*,*/**}.

0reactions
ikornienkocommented, Apr 22, 2020

Ah, I missed that in the docs, thank you for pointing out!

Hm, ok, it does make it tricky then in my case. Parameter value, opposite to the route itself, is more dynamic in most of the UIs, therefore a capability to specify “any call to this route with any query parameter value” would be great, yet I struggle now to do it with glob patterns.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular JS 'route' doesn't match component with %2F ...
but the / is encoded, I'm not creating nested components. Just one component - that might contain a %2F. If that doesn't work,...
Read more >
Routers - Traefik Labs documentation
In Traefik Proxy, a router is in charge of connecting incoming requests to the Services that can handle them. Read the technical documentation....
Read more >
Web on Servlet Stack - Spring
Designed for web use, this solution deals effectively with encoding and path parameters, and matches efficiently. AntPathMatcher — match String patterns against ...
Read more >
URL Dispatch - Actix
URL dispatch provides a simple way for mapping URLs to handler code using a simple pattern matching language. If one of the patterns...
Read more >
How to use character encoding classes in .NET - Microsoft Learn
A fallback strategy determines how an encoder handles invalid characters or ... When a character does not have an exact match in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found