|
|
@ -129,15 +129,16 @@ class HttpReadAloudService : BaseReadAloudService(), |
|
|
|
headerMapF = httpTts.getHeaderMap(true) |
|
|
|
headerMapF = httpTts.getHeaderMap(true) |
|
|
|
) |
|
|
|
) |
|
|
|
var response = analyzeUrl.getResponseAwait() |
|
|
|
var response = analyzeUrl.getResponseAwait() |
|
|
|
httpTts.loginCheckJs?.let { checkJs -> |
|
|
|
httpTts.loginCheckJs?.takeIf { checkJs -> |
|
|
|
if (checkJs.isNotBlank()) { |
|
|
|
checkJs.isNotBlank() |
|
|
|
response = analyzeUrl.evalJS(checkJs, response) as Response |
|
|
|
}?.let { checkJs -> |
|
|
|
} |
|
|
|
response = analyzeUrl.evalJS(checkJs, response) as Response |
|
|
|
} |
|
|
|
} |
|
|
|
val contentTypeRegex = httpTts.contentType |
|
|
|
httpTts.contentType?.takeIf { ct -> |
|
|
|
if (!contentTypeRegex.isNullOrBlank()) { |
|
|
|
ct.isNotBlank() |
|
|
|
|
|
|
|
}?.let { ct -> |
|
|
|
response.headers["Content-Type"]?.let { contentType -> |
|
|
|
response.headers["Content-Type"]?.let { contentType -> |
|
|
|
if (!contentType.matches(contentTypeRegex.toRegex())) { |
|
|
|
if (!contentType.matches(ct.toRegex())) { |
|
|
|
throw NoStackTraceException(response.body!!.string()) |
|
|
|
throw NoStackTraceException(response.body!!.string()) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|