1111'use strict'
1212
1313var util = require ( 'util' )
14- var shell = require ( '../../ helpers/shell ' )
14+ var helpers = require ( './ helpers' )
1515var CodeBuilder = require ( '../../helpers/code-builder' )
1616
1717module . exports = function ( source , options ) {
@@ -23,7 +23,7 @@ module.exports = function (source, options) {
2323 var code = new CodeBuilder ( opts . indent , opts . indent !== false ? ' \\\n' + opts . indent : ' ' )
2424
2525 code . push ( util . format ( 'curl %s %s' , opts . short ? '-X' : '--request' , source . method ) )
26- . push ( util . format ( '%s%s' , opts . short ? '' : '--url ' , shell . quote ( source . fullUrl ) ) )
26+ . push ( util . format ( '%s%s' , opts . short ? '' : '--url ' , helpers . quote ( source . fullUrl ) ) )
2727
2828 if ( source . httpVersion === 'HTTP/1.0' ) {
2929 code . push ( opts . short ? '-0' : '--http1.0' )
@@ -32,23 +32,23 @@ module.exports = function (source, options) {
3232 // construct headers
3333 Object . keys ( source . headersObj ) . sort ( ) . map ( function ( key ) {
3434 var header = util . format ( '%s: %s' , key , source . headersObj [ key ] )
35- code . push ( util . format ( '%s %s' , opts . short ? '-H' : '--header' , shell . quote ( header ) ) )
35+ code . push ( util . format ( '%s %s' , opts . short ? '-H' : '--header' , helpers . quote ( header ) ) )
3636 } )
3737
3838 if ( source . allHeaders . cookie ) {
39- code . push ( util . format ( '%s %s' , opts . short ? '-b' : '--cookie' , shell . quote ( source . allHeaders . cookie ) ) )
39+ code . push ( util . format ( '%s %s' , opts . short ? '-b' : '--cookie' , helpers . quote ( source . allHeaders . cookie ) ) )
4040 }
4141
4242 // request body
4343 if ( source . postData . text ) {
44- code . push ( util . format ( '%s %s' , opts . short ? '-d' : '--data' , shell . escape ( shell . quote ( source . postData . text ) ) ) )
44+ code . push ( util . format ( '%s %s' , opts . short ? '-d' : '--data' , helpers . escape ( helpers . quote ( source . postData . text ) ) ) )
4545 }
4646
4747 // construct post params
4848 if ( ! source . postData . text && source . postData . params ) {
4949 source . postData . params . map ( function ( param ) {
5050 var post = util . format ( '%s=%s' , param . name , param . value )
51- code . push ( util . format ( '%s %s' , opts . short ? '-F' : '--form' , shell . quote ( post ) ) )
51+ code . push ( util . format ( '%s %s' , opts . short ? '-F' : '--form' , helpers . quote ( post ) ) )
5252 } )
5353 }
5454
0 commit comments