Skip to content

WHATWG-URL may not display poperly #36337

Closed
@tkoelpin

Description

@tkoelpin
  • Version: 15.3.0
  • Platform: Windows 64-bit
  • Subsystem: WHATWG-URL

What steps will reproduce the bug?

const url = require('url');
let href = new URL('https://127.0.0.1/v1/users?');
console.log(href);

How often does it reproduce? Is there a required condition?

It does reproduce every single time.

What is the expected behavior?

I really expect that the URL contains in the search-attribute a single question mark.

URL {
  href: 'https://127.0.0.1/v1/users?',
  origin: 'https://127.0.0.1',
  protocol: 'https:',
  username: '',
  password: '',
  host: '127.0.0.1',
  hostname: '127.0.0.1',
  port: '',
  pathname: '/v1/users',
  search: '?',
  searchParams: URLSearchParams {},
  hash: ''
}

What do you see instead?

I see instead the search-attribute with an empty string.

URL {
  href: 'https://127.0.0.1/v1/users?',
  origin: 'https://127.0.0.1',
  protocol: 'https:',
  username: '',
  password: '',
  host: '127.0.0.1',
  hostname: '127.0.0.1',
  port: '',
  pathname: '/v1/users',
  search: '',
  searchParams: URLSearchParams {},
  hash: ''
}

Additional information

I need this missing feature for my automated API testing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wrong repoIssues that should be opened in another repository.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions