优化
This commit is contained in:
@@ -97,7 +97,7 @@ interface BaseSource : JsExtensions {
|
|||||||
* 解析header规则
|
* 解析header规则
|
||||||
*/
|
*/
|
||||||
fun getHeaderMap(hasLoginHeader: Boolean = false) = HashMap<String, String>().apply {
|
fun getHeaderMap(hasLoginHeader: Boolean = false) = HashMap<String, String>().apply {
|
||||||
if (checkRhinoRecursiveCall()) return@apply
|
checkRhinoRecursiveCall()
|
||||||
header?.let {
|
header?.let {
|
||||||
GSON.fromJsonObject<Map<String, String>>(
|
GSON.fromJsonObject<Map<String, String>>(
|
||||||
when {
|
when {
|
||||||
|
|||||||
@@ -13,10 +13,14 @@ fun Context?.getEnterCount(): Int {
|
|||||||
return enterCountField.get(this) as Int
|
return enterCountField.get(this) as Int
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkRhinoRecursiveCall(): Boolean {
|
fun checkRhinoRecursiveCall() {
|
||||||
return Context.getCurrentContext().getEnterCount() > 1
|
check(Context.getCurrentContext().getEnterCount() <= 1) {
|
||||||
|
"Rhino recursive call detected."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkRhinoCall(): Boolean {
|
fun checkRhinoCall() {
|
||||||
return Context.getCurrentContext() != null
|
check(Context.getCurrentContext() == null) {
|
||||||
|
"Rhino call detected."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user