@@ -10662,17 +10662,59 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1066210662
1066310663 getDoc4TestCase: function () {
1066410664 var list = this.remotes || []
10665- var doc = ''
10666- var item
10665+ var s = ''
1066710666 for (var i = 0; i < list.length; i ++) {
10668- item = list[i] == null ? null : list[i].Document
10669- if (item == null || item.name == null) {
10667+ var item = list[i]
10668+ var doc = item == null ? null : item.Document
10669+ if (doc == null || doc.name == null) {
1067010670 continue
1067110671 }
10672- doc += '\n\n#### ' + (item.version > 0 ? 'V' + item.version : 'V*') + ' ' + item.name + ' ' + item.url
10673- doc += '\n```json\n' + item.request + '\n```\n'
10672+ var tr = item.TestRecord
10673+
10674+ var req = doc.request
10675+ var res = ''
10676+ try {
10677+ var m = this.getMethod(doc.url);
10678+ var standardObj = null;
10679+ try {
10680+ standardObj = parseJSON(doc.standard);
10681+ } catch (e3) {
10682+ log(e3)
10683+ }
10684+
10685+ var isAPIJSONRouter = false;
10686+ try {
10687+ var apijson = parseJSON(doc.apijson);
10688+ isAPIJSONRouter = JSONResponse.isObject(apijson)
10689+ } catch (e3) {
10690+ log(e3)
10691+ }
10692+
10693+ req = StringUtil.trim(CodeUtil.parseComment(req, docObj == null ? null : docObj['[]'], m, this.database, this.language, true, standardObj, null, true, isAPIJSONRouter));
10694+
10695+ if (this.view != 'markdown') {
10696+ res = tr == null ? null : tr.response
10697+ var standardObj2 = null;
10698+ try {
10699+ standardObj2 = StringUtil.isEmpty(res) ? null : parseJSON(tr.standard);
10700+ } catch (e3) {
10701+ log(e3)
10702+ }
10703+
10704+ if (StringUtil.isNotEmpty(standardObj2)) {
10705+ res = StringUtil.trim(CodeUtil.parseComment(format(res), docObj == null ? null : docObj['[]'], m, this.database, this.language, false, standardObj2, null, true, isAPIJSONRouter));
10706+ }
10707+ }
10708+ } catch (e) {
10709+ log(e)
10710+ }
10711+
10712+ s += '\n\n#### ' + (i + 1) + '. ' + (doc.version > 0 ? 'V' + doc.version : 'V*') + ' ' + doc.name + ' ' + (doc.method || '') + ' ' + (doc.type || '') + ' ' + doc.url;
10713+ s += '\n```json\n' + req + '\n```\n';
10714+ s += StringUtil.isEmpty(res) ? '' : '\n=> Response:\n```json\n' + res + '\n```\n';
1067410715 }
10675- return doc
10716+
10717+ return s
1067610718 },
1067710719
1067810720 enableCross: function (enable) {
@@ -11633,7 +11675,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1163311675 args[6] = 'err2';
1163411676 }
1163511677
11636- toEval = 'put4Path((ctx || {}).ctx || {}, ' + JSON.stringify(path) + ', ' + args.slice(5).join(', ' ) + ')';
11678+ toEval = 'put4Path((ctx || {}).ctx || {}, ' + JSON.stringify(path) + ', ' + args.slice(5).join() + ')';
1163711679 try {
1163811680 var ret = eval(StringUtil.trim(preScript) + '\n;\n(' + toEval + ')')
1163911681 invoke(ret, which, p_k, pathKeys, key, lastKeyInPath);
@@ -11667,7 +11709,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1166711709 args[6] = 'err2';
1166811710 }
1166911711
11670- toEval = 'put4Path((ctx || {}).ctx || {}, ' + JSON.stringify(path) + ', ' + args.slice(5).join() + ')';
11712+ toEval = 'put4Path((ctx || {}).ctx || {}, ' + JSON.stringify(path) + ', ' + args.slice(5).join(', ' ) + ')';
1167111713 try {
1167211714 var ret = eval(StringUtil.trim(preScript) + '\n;\n(' + toEval + ')')
1167311715 invoke(ret, which, p_k, pathKeys, key, lastKeyInPath);
0 commit comments