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

Update to use WHATWG URL API #28369

Open
mschile opened this issue Nov 20, 2023 · 2 comments
Open

Update to use WHATWG URL API #28369

mschile opened this issue Nov 20, 2023 · 2 comments
Labels
type: enhancement Requested enhancement of existing feature

Comments

@mschile
Copy link
Contributor

mschile commented Nov 20, 2023

What would you like?

We currently use the legacy url API in a lot of our codebase which is not WHATWG URL API compliant and can lead to differences from what we receive from CDP (see #28354). We should update to use the newer URL class.

Why is this needed?

To ensure we are staying up to date with the current URL standards.

Other

No response

@jennifer-shehane jennifer-shehane added type: bug type: enhancement Requested enhancement of existing feature good first issue Good for newcomers and removed type: bug labels Nov 20, 2023
@alex-k-exe
Copy link

I would like to work on this issue, could someone please assign me

The WHATWG API docs says you should use const url = require('node:url'); to access it, is this what I'm meant to do?
Also, is the url.d.ts type at /workspaces/cypress/node_modules/@types/node/url.d.ts related to this?
I'm planning to update uri.ts at /workspaces/cypress/packages/network/lib/uri.ts but I think .query and .path would have to be replaced by .search in the new API in this part:

export function origin (urlStr: string) {
  const parsed = new URL(urlStr)

  parsed.hash = ''
  parsed.search = ''
  parsed.query = ''
  parsed.path = ''
  parsed.pathname = ''

  return URL.format(parsed)
}

If you somehow can't tell, this is my first time contributing, so thanks for reading

@mschile mschile removed the good first issue Good for newcomers label Nov 29, 2023
@mschile
Copy link
Contributor Author

mschile commented Nov 29, 2023

Hi @alex-k-exe 👋, sorry for the delay in responding and thanks for your interest in contributing. I took a look at this issue again and removed the good first issue label since it is more involved than just changing over to the new URL API due to lack of support for relative urls.

Please feel free to take a look at our other good first issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

No branches or pull requests

3 participants