Skip to content

Commit

Permalink
Temporary disable URL extension for NextURL
Browse files Browse the repository at this point in the history
  • Loading branch information
javivelasco committed Dec 13, 2021
1 parent 98ae0e1 commit 3a76a8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions packages/next/server/web/next-url.ts
Expand Up @@ -14,7 +14,7 @@ interface Options {

const Internal = Symbol('NextURLInternal')

export class NextURL extends URL {
export class NextURL {
[Internal]: {
url: URL
options: Options
Expand All @@ -36,12 +36,13 @@ export class NextURL extends URL {
baseOrOpts?: string | URL | Options,
opts?: Options
) {
super('http://127.0.0.1') // This works as a placeholder

let base: undefined | string | URL
let options: Options

if (baseOrOpts instanceof URL || typeof baseOrOpts === 'string') {
if (
(typeof baseOrOpts === 'object' && 'pathname' in baseOrOpts) ||
typeof baseOrOpts === 'string'
) {
base = baseOrOpts
options = opts || {}
} else {
Expand Down
3 changes: 2 additions & 1 deletion test/unit/web-runtime/next-url.test.ts
@@ -1,7 +1,8 @@
/* eslint-env jest */
import { NextURL } from 'next/dist/server/web/next-url'

it('has the right shape and prototype', () => {
// TODO Make NextURL extend URL
it.skip('has the right shape and prototype', () => {
const parsed = new NextURL('/about?param1=value1', 'http://127.0.0.1')
expect(parsed).toBeInstanceOf(URL)
})
Expand Down

0 comments on commit 3a76a8a

Please sign in to comment.