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

Get rid of deprecated Node.js API: url.parse #20

Open
huan opened this issue Jun 22, 2019 · 0 comments
Open

Get rid of deprecated Node.js API: url.parse #20

huan opened this issue Jun 22, 2019 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@huan
Copy link
Owner

huan commented Jun 22, 2019

file-box/src/misc.ts

Lines 90 to 98 in 3788e59

/* eslint node/no-deprecated-api: off */
// FIXME:
const parsedUrl = nodeUrl.parse(url)
const protocol = parsedUrl.protocol
let options: http.RequestOptions
let get: typeof https.get

If we use new url.URL() to replace url.parse, the unit tests will fail, and the reason still needs to be found.

url.parse

Url {
  protocol: 'https:',
  slashes: true,
  auth: null,
  host: 'httpbin.org',
  port: null,
  hostname: 'httpbin.org',
  hash: null,
  search: null,
  query: null,
  pathname: '/headers',
  path: '/headers',
  href: 'https://httpbin.org/headers' }

new url.URL

URL {
  href: 'https://httpbin.org/headers',
  origin: 'https://httpbin.org',
  protocol: 'https:',
  username: '',
  password: '',
  host: 'httpbin.org',
  hostname: 'httpbin.org',
  port: '',
  pathname: '/headers',
  search: '',
  searchParams: URLSearchParams {},
  hash: '' }
https://httpbin.org/headers
@huan huan added bug Something isn't working help wanted Extra attention is needed labels Jun 22, 2019
binsee added a commit to binsee/file-box that referenced this issue Feb 3, 2023
Fixes: Get rid of deprecated Node.js API: url.parse huan#20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant