Files
apidash/packages/curl_parser/example/curl_parser_example.dart
Ashita Prasad 5df562d73a Add curl_parser
2024-11-24 06:01:04 +05:30

16 lines
451 B
Dart

import 'package:curl_parser/curl_parser.dart';
void main() {
// Parse a cURL command
final curlString = 'curl -X GET https://www.example.com/';
final curl = Curl.parse(curlString);
// Access parsed data
print(curl.method); // GET
print(curl.uri); // https://www.example.com/
// Format Curl object to a cURL command
final formattedCurlString = curl.toCurlString();
print(formattedCurlString); // curl "https://www.example.com/""
}