-
Notifications
You must be signed in to change notification settings - Fork 107
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
Add origin property #36
Comments
Hm, yeah it should really belong in this module. The generation of origin properties is currently deferred to the |
I see an issue with blob URLs as it seems that url-parse does not parse them correctly. url-parse> var URL = require('.')
undefined
> new URL('blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f')
URL {
protocol: 'blob:',
slashes: false,
hash: '',
query: '',
pathname: '//whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f',
auth: '',
host: 'https:',
port: '',
hostname: 'https:',
password: '',
username: '',
href: 'blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f' } Chromenew URL('blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f')
URL {href: "blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f", origin: "https://whatwg.org", protocol: "blob:", username: "", password: ""…}
hash: ""
host: ""
hostname: ""
href: "blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f"
origin: "https://whatwg.org"
password: ""
pathname: "https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f"
port: ""
protocol: "blob:"
search: ""
username: "" Node.js> url.parse('blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f')
Url {
protocol: 'blob:',
slashes: null,
auth: null,
host: 'https',
port: null,
hostname: 'https',
hash: null,
search: null,
query: null,
pathname: '//whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f',
path: '//whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f',
href: 'blob:https//whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f' } so I think we should fix this first. All other cases seem easy to handle as origin is just the result of: url.origin = url.protocol && url.host ? `${url.protocol}//${url.host}` : 'null'; I guess we should also add the ability to set the origin using |
@lpinca Node does have the same issue here, but that is probably something we should resolve/discuss in a different issue. |
Released 1.1.2 with a fix for this. |
The URL spec includes an origin property: https://url.spec.whatwg.org/#origin
This isn't currently supported in url-parse, but it'd be fantastically useful if it did. :)
The text was updated successfully, but these errors were encountered: