Skip to content

Commit

Permalink
fix: add json only if
Browse files Browse the repository at this point in the history
  • Loading branch information
de-sh committed Jan 19, 2025
1 parent 1d94ae7 commit 01c1e5a
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/handlers/http/cluster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,22 @@ pub async fn sync_streams_with_ingestors(
base_path_without_preceding_slash(),
stream_name
);
let res = HTTP_CLIENT
let mut req = HTTP_CLIENT
.put(url)
.headers(reqwest_headers.clone())
.header(header::AUTHORIZATION, &ingestor.token)
.json(&static_schema)
.send()
.await
.map_err(|err| {
error!(
"Fatal: failed to forward upsert stream request to ingestor: {}\n Error: {:?}",
ingestor.domain_name, err
);
StreamError::Network(err)
})?;
.header(header::AUTHORIZATION, &ingestor.token);

if let Some(schema) = static_schema.as_ref() {
req = req.json(schema);
}

let res = req.send().await.map_err(|err| {
error!(
"Fatal: failed to forward upsert stream request to ingestor: {}\n Error: {:?}",
ingestor.domain_name, err
);
StreamError::Network(err)
})?;

if !res.status().is_success() {
error!(
Expand Down

0 comments on commit 01c1e5a

Please sign in to comment.