!132 fix: 动态请求中,body的json参数使用javasctipt

Merge pull request !132 from guo_ddt/master-fetch
This commit is contained in:
奔跑的面条
2023-03-04 05:46:01 +00:00
parent b269933ffa
commit a4ec0080e9
2 changed files with 7 additions and 1 deletions
+4
View File
@@ -321,6 +321,10 @@ export const JSONStringify = <T>(data: T) => {
export const JSONParse = (data: string) => {
return JSON.parse(data, (k, v) => {
if (excludeParseEventKeyList.includes(k)) return v
if(typeof v === 'string' && v.indexOf('javascript:') > -1){
//动态请求json中'javascript:'内容会影响模板content解析,直接返回
return v
}
if (typeof v === 'string' && v.indexOf && (v.indexOf('function') > -1 || v.indexOf('=>') > -1)) {
return eval(`(function(){return ${v}})()`)
} else if (typeof v === 'string' && v.indexOf && (v.indexOf('return ') > -1)) {