11'use strict' ;
22
3- var util = require ( 'util' ) ;
3+ // var util = require('util');
44
55module . exports = function ( options ) {
6- var opts = util . _extend ( {
7- indent : ' '
8- } , options ) ;
6+
7+ // Might want to add error checking in as option
8+
9+ // var opts = util._extend({
10+ // errorChecking: false
11+ // }, options);
912
1013 // Set some shortcuts
1114 var req = {
@@ -30,30 +33,29 @@ module.exports = function (options) {
3033 code . push ( '\t"net/http"' ) ;
3134 code . push ( ')\n' ) ;
3235
33- code . push ( 'func main() {' )
36+ code . push ( 'func main() {' ) ;
3437
3538 // Create client
3639 code . push ( '\tclient := &http.Client{}' ) ;
37- code . push ( '\turl := "' + req . url + '"' )
40+ code . push ( '\turl := "' + req . url + '"' ) ;
3841
3942 // If we have body content or not create the var and reader or nil
4043 if ( bodyPresent ) {
41- code . push ( '\tbody := ' + JSON . stringify ( this . source . postData . text ) )
42- req . body = 'strings.NewReader(body)'
44+ code . push ( '\tbody := ' + JSON . stringify ( this . source . postData . text ) ) ;
45+ req . body = 'strings.NewReader(body)' ;
4346 } else {
44- req . body = 'nil'
47+ req . body = 'nil' ;
4548 }
4649
4750 code . push ( '\treq, _ := http.NewRequest("' + req . method + '", url, ' + req . body + ')' ) ;
4851
49-
5052 // Add headers
5153 var headersPresent = this . source . headers && this . source . headers . length ;
5254
5355 if ( headersPresent ) {
5456 for ( var header in this . source . headers ) {
55- var key = this . source . headers [ header ] . name
56- var val = this . source . headers [ header ] . value
57+ var key = this . source . headers [ header ] . name ;
58+ var val = this . source . headers [ header ] . value ;
5759 code . push ( '\treq.Header.Add("' + key + '", "' + val + '")' ) ;
5860 }
5961 }
@@ -74,7 +76,7 @@ module.exports = function (options) {
7476 code . push ( '\tfmt.Printf("%+v", res)' ) ;
7577
7678 // End main block
77- code . push ( '}' )
79+ code . push ( '}' ) ;
7880
7981 return code . join ( '\n' ) ;
8082} ;
0 commit comments