File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,50 @@ describe('curl convert function', function () {
289
289
} ) ;
290
290
} ) ;
291
291
292
+ it ( 'should return snippet with JSON body in single line if multiline option is false' , function ( ) {
293
+ request = new Request ( {
294
+ 'method' : 'POST' ,
295
+ 'header' : [ ] ,
296
+ 'body' : {
297
+ 'mode' : 'raw' ,
298
+ 'raw' : '{\n "name": "John",\n "type": "names",\n "id": "123sdaw"\n}' ,
299
+ 'options' : {
300
+ 'raw' : {
301
+ 'language' : 'json'
302
+ }
303
+ }
304
+ } ,
305
+ 'url' : {
306
+ 'raw' : 'https://postman-echo.com/post' ,
307
+ 'protocol' : 'https' ,
308
+ 'host' : [
309
+ 'postman-echo' ,
310
+ 'com'
311
+ ] ,
312
+ 'path' : [
313
+ 'post'
314
+ ]
315
+ }
316
+ } ) ;
317
+ options = {
318
+ multiLine : false ,
319
+ longFormat : false ,
320
+ lineContinuationCharacter : '\\' ,
321
+ quoteType : 'single' ,
322
+ requestTimeoutInSeconds : 0 ,
323
+ followRedirect : true ,
324
+ followOriginalHttpMethod : false
325
+ } ;
326
+
327
+ convert ( request , options , function ( error , snippet ) {
328
+ if ( error ) {
329
+ expect . fail ( null , null , error ) ;
330
+ }
331
+ expect ( snippet ) . to . be . a ( 'string' ) ;
332
+ expect ( snippet ) . to . contain ( '-d \'{"name":"John","type":"names","id":"123sdaw"}\'' ) ;
333
+ } ) ;
334
+ } ) ;
335
+
292
336
it ( 'should return snippet with backslash(\\) character as line continuation ' +
293
337
'character for multiline code generation' , function ( ) {
294
338
request = new Request ( {
You can’t perform that action at this time.
0 commit comments