diff --git a/lib/captcha.js b/lib/captcha.js index 197496f..4d6a71c 100644 --- a/lib/captcha.js +++ b/lib/captcha.js @@ -35,11 +35,10 @@ const solve = async (response) => { body.push('h-captcha-response=' + captchaResponse); } - const baseUrl = response.url.substring(0, response.url.lastIndexOf('/')); const { method, action, enctype } = document.getElementById('challenge-form'); return { method, - url: action.startsWith('/') ? baseUrl + action : action, + url: new URL(action, response.url), headers: { 'content-type': enctype, // application/x-www-form-urlencoded },