Skip to content

Commit 9774203

Browse files
committed
🚑 Resource is not valid URL
1 parent 8368817 commit 9774203

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎src/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ function request<P extends Payload>(
213213
): ResponsePromise<P> {
214214
const options: RequestOptions<P> = mergeOptions(DEFAULTS, baseOptions)
215215
const promise = new Promise<Response<P>>((resolve, reject) => {
216-
const url = new URL(options.resource)
216+
const url = new URL(
217+
options.resource,
218+
typeof location === 'undefined' ? undefined : location.origin
219+
)
220+
217221
url.search += options.params
218222

219223
if (options.json != null) {

0 commit comments

Comments
 (0)