fix: har,postman 导入json-schema 为false

This commit is contained in:
gaoxiaolin.gao 2018-04-28 20:03:27 +08:00
parent e5c9c25be8
commit c4cb298624
2 changed files with 10 additions and 3 deletions

View File

@ -162,6 +162,7 @@ function postman(importDataModule){
}
}else if(item === 'req_body_other' && reqType === 'json' && data.request.postData){
res.req_body_is_json_schema = true
res[item] = transformJsonToSchema(data.request.postData.text);
}else if(item === "req_headers"){
res[item] = [{
@ -185,6 +186,7 @@ function postman(importDataModule){
}else if(item === 'res_body_type'){
res[item] = 'json';
}else if(item === 'res_body' ){
res.res_body_is_json_schema = true
res[item] = transformJsonToSchema(data.response.content.text);
}
else{

View File

@ -163,7 +163,7 @@ function postman(importDataModule){
} else if(item === 'req_body_other') {
if(data.headers.indexOf('application/json')>-1){
res.req_body_is_json_schema = true
res[item] = transformJsonToSchema(data[reflect[item]])
} else {
res[item] = data[reflect[item]];
@ -220,8 +220,13 @@ function postman(importDataModule){
let res = data[0];
let response = {};
response['res_body_type'] = res.language === 'json' ? 'json' : 'raw'
response['res_body'] = res.language === 'json' ? transformJsonToSchema(res.text): res.text;
// response['res_body'] = res.language === 'json' ? transformJsonToSchema(res.text): res.text;
if(res.language === 'json') {
response['res_body_is_json_schema'] = true
response['res_body'] = transformJsonToSchema(res.text)
} else {
response['res_body'] = res.text
}
return response;
}