Skip to content

Commit

Permalink
fix: checking param for bounding_box method
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-duboyski committed Nov 9, 2023
1 parent 2d4bd42 commit 1b2223a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/utils/checkCaptchaParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1b2223a

Please sign in to comment.