From 1b2223a4063f6f92bf7d67c366c456ef870a8ebc Mon Sep 17 00:00:00 2001 From: Dima Dub Date: Thu, 9 Nov 2023 22:52:11 +0400 Subject: [PATCH] fix: checking param for bounding_box method --- src/utils/checkCaptchaParams.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/utils/checkCaptchaParams.ts b/src/utils/checkCaptchaParams.ts index 87bcdbd..faabc6b 100644 --- a/src/utils/checkCaptchaParams.ts +++ b/src/utils/checkCaptchaParams.ts @@ -108,11 +108,12 @@ export default function checkCaptchaParams(params: Object, method: string) { }) if(method === "bounding_box") { - if(params.hasOwnProperty('textinstructions') || params.hasOwnProperty('imginstructions')) - isCorrectCaptchaParams = true - } else { - isCorrectCaptchaParams = false - throw new Error(`Error when check params captcha.\nNot found "textinstructions" or "imginstructions" field in the Object. One of this field is required for "bounding_box" method. Please add field "textinstructions" or "imginstructions" in object and try again.\nPlease correct your code for the "bounding_box" method according to the code examples on page https://www.npmjs.com/package/2captcha-ts`) + if(params.hasOwnProperty('textinstructions') || params.hasOwnProperty('imginstructions')) { + isCorrectCaptchaParams = true + } else { + isCorrectCaptchaParams = false + throw new Error(`Error when check params captcha.\nNot found "textinstructions" or "imginstructions" field in the Object. One of this field is required for "bounding_box" method. Please add field "textinstructions" or "imginstructions" in object and try again.\nPlease correct your code for the "bounding_box" method according to the code examples on page https://www.npmjs.com/package/2captcha-ts`) + } } return isCorrectCaptchaParams