-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Implement URL Accessors (host, hostname, username, password) for the URL class #48505
base: main
Are you sure you want to change the base?
Conversation
Hi @krishpranav! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
I've signed the cla |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Hi, any updates on it? |
This is a very commonly used class - I don't think we'd want to pay the cost upfront of parsing any URL passed in here. |
// $FlowFixMe[incompatible-type] asserted above | ||
// $FlowFixMe[unsafe-addition] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed?
|
||
function validateBaseUrl(url: string) { | ||
// from this MIT-licensed gist: https://gist.github.com/dperini/729294 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this
// Parsing the URL to use for accessors | ||
this._parsedUrl = new globalThis.URL(this._url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which JSVM was this tested with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node version: v20.18.1
@javache reverting the comments. |
@javache I've reverted the comments. kindly check it. |
#45030
Title:
Implement URL Accessors (host, hostname, username, password) for the URL class
Description:
Summary:
This PR addresses GitHub issue #45030 by implementing the missing URL accessors (
host
,hostname
,username
, andpassword
) in theURL
class for React Native. Prior to this change, accessing these properties would result in errors as they were not implemented. This update ensures compatibility with standard URL parsing and usage within the React Native ecosystem, especially for applications relying on web-based APIs that require access to these URL components.Motivation:
These accessors are critical for extracting and working with specific URL components (e.g., domain, user credentials) in various networking scenarios. The lack of implementation was preventing the proper usage of these components in React Native, particularly when interacting with URLs that include authentication information or need parsing of domain-related properties.
Changelog:
host
,hostname
,username
, andpassword
accessors for theURL
class in React Native.URL
class to support retrieval ofhost
,hostname
,username
, andpassword
from the URL string, ensuring these properties return the correct values based on the URL structure.Test Plan:
To ensure the functionality of the newly implemented accessors, I performed the following:
Unit Tests:
host
,hostname
,username
, andpassword
accessors in various scenarios.Test Cases:
Here is a sample test case:
All tests passed successfully, demonstrating that the changes are robust and do not introduce regressions.
Kindly let me know whether is there any further things needed to add on this pull request, I am a new contributor to this repo. I am looking forward to work on this repo and work on the untouched issues which needed fix. thanks :)