@@ -15,14 +15,15 @@ self = module.exports = {
15
15
options = sanitizeOptions ( options , self . getOptions ( ) ) ;
16
16
17
17
var indent , trim , headersData , body , redirect , timeout , multiLine ,
18
- format , snippet , silent , url ;
18
+ format , snippet , silent , url , quoteType ;
19
19
20
20
redirect = options . followRedirect ;
21
21
timeout = options . requestTimeout ;
22
22
multiLine = options . multiLine ;
23
23
format = options . longFormat ;
24
24
trim = options . trimRequestBody ;
25
25
silent = options . silent ;
26
+ quoteType = options . quoteType === 'single' ? '\'' : '"' ;
26
27
27
28
snippet = silent ? `curl ${ form ( '-s' , format ) } ` : 'curl' ;
28
29
if ( redirect ) {
@@ -40,10 +41,10 @@ self = module.exports = {
40
41
}
41
42
url = getUrlStringfromUrlObject ( request . url ) ;
42
43
if ( request . method === 'HEAD' ) {
43
- snippet += ` ${ form ( '-I' , format ) } ' ${ url } ' ` ;
44
+ snippet += ` ${ form ( '-I' , format ) } ${ quoteType + url + quoteType } ` ;
44
45
}
45
46
else {
46
- snippet += ` ${ form ( '-X' , format ) } ${ request . method } ' ${ url } ' ` ;
47
+ snippet += ` ${ form ( '-X' , format ) } ${ request . method } ${ quoteType + url + quoteType } ` ;
47
48
}
48
49
49
50
if ( request . body && ! request . headers . has ( 'Content-Type' ) ) {
@@ -186,6 +187,15 @@ self = module.exports = {
186
187
description : 'Set a character used to mark the continuation of a statement on the next line ' +
187
188
'(generally, \\ for OSX/Linux, ^ for Windows)'
188
189
} ,
190
+ {
191
+ name : 'Quote Type' ,
192
+ id : 'quoteType' ,
193
+ availableOptions : [ 'single' , 'double' ] ,
194
+ type : 'string' ,
195
+ default : 'single' ,
196
+ description : 'String denoting the quote type to use (single or double) for URL ' +
197
+ '(Use double quotes when running curl in cmd.exe and single quotes for the rest)'
198
+ } ,
189
199
{
190
200
name : 'Set request timeout' ,
191
201
id : 'requestTimeout' ,
0 commit comments