Skip to content

Commit

Permalink
Improve --encode logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh1Yo committed Jul 25, 2021
1 parent 6ddcd9e commit 7e52e1e
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,21 @@ pub fn get_config() -> (Config, usize) {
.to_string();

if !args.is_present("as-body") && !within_headers && !args.is_present("headers-discovery") && url.contains('?') && url.contains('=') && !url.contains("%s") {
url.push_str("&%s");
path.push_str("&%s");
if args.is_present("encode") {
url.push_str("%26%s");
path.push_str("%26%s");
} else {
url.push_str("&%s");
path.push_str("&%s");
}
} else if !args.is_present("as-body") && !within_headers &&!args.is_present("headers-discovery") && !url.contains("%s") {
url.push_str("?%s");
path.push_str("?%s");
if args.is_present("encode") {
url.push_str("%3f%s");
path.push_str("%3f%s");
} else {
url.push_str("?%s");
path.push_str("?%s");
}
}

let parameter_template = match args.is_present("keep-newlines") {
Expand Down

0 comments on commit 7e52e1e

Please sign in to comment.