Handle "no body" case

This commit is contained in:
Gregory Schier
2023-03-20 13:49:21 -07:00
parent bb139744a1
commit a938dc45f0
4 changed files with 12 additions and 11 deletions

View File

@@ -136,9 +136,9 @@ async fn send_request(
Method::from_bytes(req.method.to_uppercase().as_bytes()).expect("Failed to create method");
let builder = client.request(m, url_string.to_string()).headers(headers);
let sendable_req_result = match req.body {
Some(b) => builder.body(b).build(),
None => builder.build(),
let sendable_req_result = match (req.body, req.body_type) {
(Some(b), Some(_)) => builder.body(b).build(),
_ => builder.build(),
};
let sendable_req = match sendable_req_result {