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

Handle URLs with query param and hash string both #15

Open
amitguptagwl opened this Issue Oct 27, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@amitguptagwl
Member

amitguptagwl commented Oct 27, 2018

Currently, the code expects an URL either with query string or with hash. We have to modify it if both are present.

Eg 'https://user:pass@sub.host.com:8080/p/a/t/h?query=string#hash'

@jgarciabengochea

This comment has been minimized.

jgarciabengochea commented Dec 9, 2018

Hello! @amitguptagwl Could I take this one on? I've looked through some of the code and I'm assuming this has to do with the urlSlice function in utils?

Some questions I have

  1. Will the url string always have query first then a hash?
  2. Should this handle multiple queries and or multiple hashes? (if multiple hashes are even a possibility)
  3. Is there a specific test file I should use to write tests for this method?
  4. do you have any more examples of base/ special/ edge cases of url strings this should handle?

Thank you!

@amitguptagwl

This comment has been minimized.

Member

amitguptagwl commented Dec 10, 2018

@jgarciabengochea thanks for your attention.

? is call query params identifier
# is called fragment identifier.

  1. Yes
  2. There can be multiple query params.
    • The first appearance of '?' should point the start of query params. '#'
    • The first appearance of '#' should point the start of the fragment.
  3. You can use the same test files or create a separate one, in case of multiple tests.
  4. Example
\this\is\sample?q1=val&q2=val3
\this\is\sample#q1=val&q2=val3
\this\is\sample?q1=val&q2=val3#q1=val&q2=val3
\this\is\sample?q1=val&q2=val3#q1=val#q2=val3 //# => q1=val#q2=val3

In general, multiple # are not allowed. So we can probably provide an option multipleFragmentIdentifier: true. If set to false then throw an error. But let's handle it as a separate issue.

@jgarciabengochea

This comment has been minimized.

jgarciabengochea commented Dec 11, 2018

@amitguptagwl I have just submitted a pull request with a summary of my implementation. Thank you again for the opportunity!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment