fix: default content type

This commit is contained in:
nate 2026-03-19 16:13:05 +04:00
parent 63b83e77dc
commit 30468e378d
1 changed files with 5 additions and 0 deletions

View File

@ -300,14 +300,19 @@ fn run_check_blocking(
.method(method)
.uri(url);
let mut has_content_type = false;
if let Some(hdrs) = headers {
for (k, v) in hdrs {
if k.eq_ignore_ascii_case("content-type") { has_content_type = true; }
builder = builder.header(k.as_str(), v.as_str());
}
}
let result = match body {
Some(b) => {
if !has_content_type {
builder = builder.header("Content-Type", "application/json");
}
let req = builder.body(b.as_bytes()).map_err(|e| e.to_string())?;
agent.run(req)
}