@@ -23,41 +23,41 @@ module.exports = function (source, options) {
2323
2424 code . push ( 'var unirest = require("unirest");' )
2525 . blank ( )
26- . push ( util . format ( 'var req = unirest("%s", "%s");' , source . method , source . url ) )
26+ . push ( 'var req = unirest("%s", "%s");' , source . method , source . url )
2727 . blank ( )
2828
2929 if ( source . cookies . length ) {
3030 code . push ( 'var CookieJar = unirest.jar();' )
3131
3232 source . cookies . forEach ( function ( cookie ) {
33- code . push ( util . format ( 'CookieJar.add("%s=%s","%s");' , encodeURIComponent ( cookie . name ) , encodeURIComponent ( cookie . value ) , source . url ) )
33+ code . push ( 'CookieJar.add("%s=%s","%s");' , encodeURIComponent ( cookie . name ) , encodeURIComponent ( cookie . value ) , source . url )
3434 } )
3535
3636 code . push ( 'req.jar(CookieJar);' )
3737 . blank ( )
3838 }
3939
4040 if ( Object . keys ( source . queryObj ) . length ) {
41- code . push ( util . format ( 'req.query(%s);' , JSON . stringify ( source . queryObj , null , opts . indent ) ) )
41+ code . push ( 'req.query(%s);' , JSON . stringify ( source . queryObj , null , opts . indent ) )
4242 . blank ( )
4343 }
4444
4545 if ( Object . keys ( source . headersObj ) . length ) {
46- code . push ( util . format ( 'req.headers(%s);' , JSON . stringify ( source . headersObj , null , opts . indent ) ) )
46+ code . push ( 'req.headers(%s);' , JSON . stringify ( source . headersObj , null , opts . indent ) )
4747 . blank ( )
4848 }
4949
5050 switch ( source . postData . mimeType ) {
5151 case 'application/x-www-form-urlencoded' :
5252 if ( source . postData . paramsObj ) {
53- code . push ( util . format ( 'req.form(%s);' , JSON . stringify ( source . postData . paramsObj , null , opts . indent ) ) )
53+ code . push ( 'req.form(%s);' , JSON . stringify ( source . postData . paramsObj , null , opts . indent ) )
5454 }
5555 break
5656
5757 case 'application/json' :
5858 if ( source . postData . jsonObj ) {
5959 code . push ( 'req.type("json");' )
60- . push ( util . format ( 'req.send(%s);' , JSON . stringify ( source . postData . jsonObj , null , opts . indent ) ) )
60+ . push ( 'req.send(%s);' , JSON . stringify ( source . postData . jsonObj , null , opts . indent ) )
6161 }
6262 break
6363
@@ -84,12 +84,12 @@ module.exports = function (source, options) {
8484 }
8585 } )
8686
87- code . push ( util . format ( 'req.multipart(%s);' , JSON . stringify ( multipart , null , opts . indent ) ) )
87+ code . push ( 'req.multipart(%s);' , JSON . stringify ( multipart , null , opts . indent ) )
8888 break
8989
9090 default :
9191 if ( source . postData . text ) {
92- code . push ( opts . indent + util . format ( 'req.send(%s);' , JSON . stringify ( source . postData . text , null , opts . indent ) ) )
92+ code . push ( opts . indent + 'req.send(%s);' , JSON . stringify ( source . postData . text , null , opts . indent ) )
9393 }
9494 }
9595
0 commit comments