handleBlockResponse

fun handleBlockResponse(response: String, url: String?, callback: (result: HSBotDefenderChallengeResult) -> Unit?): Boolean

Callback-based API. The callback receives only HSBotDefenderChallengeResult.SOLVED or HSBotDefenderChallengeResult.CANCELLED; HSBotDefenderChallengeResult.SOLVED_WITH_ERROR is folded down to HSBotDefenderChallengeResult.SOLVED for backward compatibility. Use handleBlockResponseWithReason to observe the full result and reason.


Handles the URL request's response and presents the challenge screen, if necessary. This suspend function is a coroutine-based alternative to handleBlockResponse. It suspends and returns the result once the challenge is solved or canceled.

When the outcome is HSBotDefenderChallengeResult.SOLVED_WITH_ERROR, only the result enum is returned — use handleBlockResponseWithReason to read the accompanying HSBotDefenderChallengeFailureReason. This function is available to Kotlin callers only and is hidden from Java via @JvmSynthetic. Java callers should use the handleBlockResponse method with a callback instead. This function should only be used when the HSPolicyUrlRequestInterceptionType is set to HSPolicyUrlRequestInterceptionType.NONE in the policy.

Return

The result of the challenge interaction.

Parameters

response

The response that was received from the URL request.

url

The URL of the request that was blocked.

Throws

if the SDK cannot handle the response. Make sure to call canHandleBlockResponse(response:) before calling this function.