Skip to content

Commit

Permalink
feat: opt-in support of whatwg-url mock (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed May 5, 2022
1 parent 276d44d commit a38cf29
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ Module | Status | Source
[npm/mime](https://www.npmjs.com/package/mime) | Polyfilled | [unenv/runtime/npm/mime](./src/runtime/npm/mime.ts)
[npm/node-fetch](https://www.npmjs.com/package/node-fetch) | Replace with Platform Native | [unenv/runtime/npm/node-fetch](./src/runtime/npm/node-fetch.ts)
[npm/cross-fetch](https://www.npmjs.com/package/node-fetch) | Replace with Platform Native | [unenv/runtime/npm/cross-fetch](./src/runtime/npm/cross-fetch.ts)


[npm/whatwg-url](https://www.npmjs.com/package/whatwg-url) | opt-in | [unenv/runtime/npm/whatwg-url](./src/runtime/npm/whatwg-url.ts)

## Auto-mocking proxy

Expand Down
20 changes: 20 additions & 0 deletions src/runtime/npm/whatwg-url.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// https://www.npmjs.com/package/whatwg-url

export const URL = globalThis.URL
export const URLSearchParams = globalThis.URLSearchParams

function notSupported () {
throw new Error('[unenv] whatwg-url low level API is not supported yet!')
}

export const parseURL = notSupported
export const basicURLParse = notSupported
export const serializeURL = notSupported
export const serializeHost = notSupported
export const serializeInteger = notSupported
export const serializeURLOrigin = notSupported
export const setTheUsername = notSupported
export const setThePassword = notSupported
export const cannotHaveAUsernamePasswordPort = notSupported
export const percentDecodeBytes = notSupported
export const percentDecodeString = notSupported

0 comments on commit a38cf29

Please sign in to comment.