@@ -406,12 +406,15 @@ export default {
406
406
}
407
407
408
408
if (this .http_method != " " ) {
409
- curl_command_string = curl_command_string + " -X" + this .http_method ;
409
+ curl_command_string =
410
+ curl_command_string + " --location --request " + this .http_method ;
410
411
}
411
412
412
413
if (this .is_application_json ) {
413
- curl_command_string =
414
- curl_command_string + ' -H "Content-type: application/json"' ;
414
+ if (this .body_type == " json" ) {
415
+ curl_command_string =
416
+ curl_command_string + ' --header "Content-type: application/json"' ;
417
+ }
415
418
}
416
419
417
420
if (this .custom_headers .length > 0 ) {
@@ -423,7 +426,7 @@ export default {
423
426
) {
424
427
curl_command_string =
425
428
curl_command_string +
426
- ' -H "' +
429
+ ' --header "' +
427
430
custom_headers[index].key +
428
431
" : " +
429
432
custom_headers[index].value +
@@ -434,7 +437,8 @@ export default {
434
437
435
438
if (this .body_type == " json" && this .json_body != " " ) {
436
439
let json_body = JSON .stringify (JSON .parse (this .json_body ));
437
- curl_command_string = curl_command_string + " -d '" + json_body + " '" ;
440
+ curl_command_string =
441
+ curl_command_string + " --data-raw '" + json_body + " '" ;
438
442
}
439
443
440
444
if (this .body_type == " form_urlencoded" && this .custom_fields != " " ) {
@@ -454,7 +458,11 @@ export default {
454
458
}
455
459
}
456
460
457
- curl_command_string = curl_command_string + " -d '" + str + " '" ;
461
+ curl_command_string =
462
+ curl_command_string + " --data-urlencode '" + str + " '" ;
463
+ curl_command_string =
464
+ curl_command_string +
465
+ ' --header "Content-Type: application/x-www-form-urlencoded"' ;
458
466
}
459
467
460
468
if (this .body_type == " form_data" && this .custom_fields != " " ) {
@@ -464,15 +472,16 @@ export default {
464
472
this .custom_fields [index].value != " "
465
473
) {
466
474
let str =
467
- " -F '" +
475
+ " --form '" +
468
476
this .custom_fields [index].key +
469
477
" =" +
470
478
this .custom_fields [index].value +
471
479
" ' " ;
472
480
473
- console .log (str);
474
-
475
481
curl_command_string = curl_command_string + str;
482
+ curl_command_string =
483
+ curl_command_string +
484
+ ' --header "Content-Type: multipart/form-data"' ;
476
485
}
477
486
}
478
487
}
0 commit comments