Skip to content

Commit

Permalink
Fix default content-type header
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh1Yo committed May 23, 2021
1 parent 43dfa6b commit 2a80a5b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "x8"
version = "1.0.0"
version = "1.0.1"
authors = ["Alexander Mironov <sh1yo@tuta.io>"]
edition = "2018"
license = "GPL-3.0-or-later"
Expand Down
18 changes: 9 additions & 9 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,17 +385,17 @@ pub fn get_config() -> (Config, usize) {
}

if !headers.keys().any(|i| i.contains("Content-Type")) && (args.is_present("as-body") || args.value_of("body").is_some()) {
match args.value_of("body-type").unwrap_or("urlencode") {
"urlencode" => Some(headers.insert(
String::from("Content-Type"),
String::from("application/x-www-form-urlencoded"),
)),
"json" => Some(headers.insert(
if body_type.contains("json") {
headers.insert(
String::from("Content-Type"),
String::from("application/json"),
)),
_ => None,
};
);
} else {
headers.insert(
String::from("Content-Type"),
String::from("application/x-www-form-urlencoded"),
);
}
}

let mut url = args
Expand Down

0 comments on commit 2a80a5b

Please sign in to comment.