Skip to content

Commit f65d3b5

Browse files
committed
handle url / string properly
1 parent fe7b0a2 commit f65d3b5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/auto-check-element.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,12 @@ async function check(autoCheckElement: AutoCheckElement) {
261261
}
262262

263263
const body = new FormData()
264+
const url = new URL(src, window.location.origin)
264265
if (httpMethod === 'POST') {
265266
body.append(csrfField, csrf)
266267
body.append('value', input.value)
267268
} else {
268-
this.url = new URL(src, window.location.origin)
269-
this.url.search = new URLSearchParams({value: input.value}).toString()
269+
url.search = new URLSearchParams({value: input.value}).toString()
270270
}
271271

272272
input.dispatchEvent(new AutoCheckSendEvent(body))
@@ -280,7 +280,7 @@ async function check(autoCheckElement: AutoCheckElement) {
280280
state.controller = makeAbortController()
281281

282282
try {
283-
const response = await fetchWithNetworkEvents(autoCheckElement, src, {
283+
const response = await fetchWithNetworkEvents(autoCheckElement, url.toString(), {
284284
credentials: 'same-origin',
285285
signal: state.controller.signal,
286286
method: httpMethod,

0 commit comments

Comments
 (0)