From 282090138dd68ffe6bf8ad52f1a17596c93b42d8 Mon Sep 17 00:00:00 2001 From: Alexander Mironov Date: Wed, 11 Aug 2021 17:30:16 +0400 Subject: [PATCH] Add raw request output (issue #9) --- README.md | 2 +- src/args.rs | 2 +- src/utils.rs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 09753e8..dfedb74 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ OPTIONS: Available: GET, POST, PUT, PATCH, DELETE, HEAD. (default is "GET") -o, --output - -O, --output-format standart, json, url (default is "standart") + -O, --output-format standart, json, url, request (default is "standart") -P, --param-template %k - key, %v - value. Example: --param-template 'user[%k]=%v&' diff --git a/src/args.rs b/src/args.rs index 93f0cdc..3be556a 100644 --- a/src/args.rs +++ b/src/args.rs @@ -84,7 +84,7 @@ pub fn get_config() -> (Config, usize) { Arg::with_name("output-format") .short("O") .long("output-format") - .help("standart, json, url (default is \"standart\")") + .help("standart, json, url, request (default is \"standart\")") .takes_value(true) ) .arg( diff --git a/src/utils.rs b/src/utils.rs index b353868..d9629c5 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -473,6 +473,9 @@ pub fn create_output(config: &Config, found_params: Vec) -> String { line }, + "request" => { + generate_request(config, &make_hashmap(&found_params, config.value_size)) + }, _ => { let mut line = format!("{} {} % ", &config.method, &config.initial_url);