@@ -32,20 +32,20 @@ function run(urlStr, body, options) {
32
32
if ( cfg ?. [ "docs" ] !== undefined ) console . log ( `Docs: ${ cfg ?. [ "docs" ] . join ( ", " ) } ` )
33
33
comment = buildComment ( url , path , opts . method , res )
34
34
35
- if ( opts ?. body ) {
36
- const paramStruct = jsonToGo ( opts ?. body , path . struct + "Param" ) ;
37
- const paramContent = buildContent (
38
- paramStruct . go , path , buildComment ( url , path , opts . method ) , true
39
- )
40
- writeParam ( JSON . stringify ( JSON . parse ( opts ?. body ) , null , "\t" ) , path , paramContent )
41
- }
42
-
43
35
return res . json ( )
44
36
} )
45
37
. then ( json => {
46
38
const struct = jsonToGo ( JSON . stringify ( json ) , path . struct ) ;
47
39
const content = buildContent ( struct . go , path , comment )
48
40
write ( json , path , content )
41
+
42
+ if ( opts ?. body ) {
43
+ const paramStruct = jsonToGo ( opts ?. body , path . struct + "Param" ) ;
44
+ const paramContent = buildContent (
45
+ paramStruct . go , path , buildComment ( url , path , opts . method ) , true
46
+ )
47
+ writeParam ( JSON . stringify ( JSON . parse ( opts ?. body ) , null , "\t" ) , path , paramContent )
48
+ }
49
49
} , ( ) => {
50
50
console . log ( )
51
51
console . log ( "Response Body is empty." )
0 commit comments