Skip to content

Commit 3a76a8a

Browse files
committed
Temporary disable URL extension for NextURL
1 parent 98ae0e1 commit 3a76a8a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/next/server/web/next-url.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface Options {
1414

1515
const Internal = Symbol('NextURLInternal')
1616

17-
export class NextURL extends URL {
17+
export class NextURL {
1818
[Internal]: {
1919
url: URL
2020
options: Options
@@ -36,12 +36,13 @@ export class NextURL extends URL {
3636
baseOrOpts?: string | URL | Options,
3737
opts?: Options
3838
) {
39-
super('http://127.0.0.1') // This works as a placeholder
40-
4139
let base: undefined | string | URL
4240
let options: Options
4341

44-
if (baseOrOpts instanceof URL || typeof baseOrOpts === 'string') {
42+
if (
43+
(typeof baseOrOpts === 'object' && 'pathname' in baseOrOpts) ||
44+
typeof baseOrOpts === 'string'
45+
) {
4546
base = baseOrOpts
4647
options = opts || {}
4748
} else {

test/unit/web-runtime/next-url.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/* eslint-env jest */
22
import { NextURL } from 'next/dist/server/web/next-url'
33

4-
it('has the right shape and prototype', () => {
4+
// TODO Make NextURL extend URL
5+
it.skip('has the right shape and prototype', () => {
56
const parsed = new NextURL('/about?param1=value1', 'http://127.0.0.1')
67
expect(parsed).toBeInstanceOf(URL)
78
})

0 commit comments

Comments
 (0)