File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ function curlToGo(curl) {
1111 var err = 'if err != nil {\n\t// handle err\n}\n' ;
1212 var deferClose = 'defer resp.Body.Close()\n' ;
1313 var promo = "// Generated by curl-to-Go: https://mholt.github.io/curl-to-go" ;
14+ var originalCmd = `// Original command: ${ curl } ` ;
15+ var header = `${ promo } \n${ originalCmd } \n` ;
1416
1517 // List of curl flags that are boolean typed; this helps with parsing
1618 // a command like `curl -abc value` to know whether 'value' belongs to '-c'
@@ -42,9 +44,9 @@ function curlToGo(curl) {
4244 var req = extractRelevantPieces ( cmd ) ;
4345
4446 if ( Object . keys ( req . headers ) . length == 0 && ! req . data . ascii && ! req . data . files && ! req . basicauth && ! req . insecure ) {
45- return promo + "\n" + renderSimple ( req . method , req . url ) ;
47+ return header + renderSimple ( req . method , req . url ) ;
4648 } else {
47- return promo + "\n \n"+ renderComplex ( req ) ;
49+ return header + " \n"+ renderComplex ( req ) ;
4850 }
4951
5052
You can’t perform that action at this time.
0 commit comments