Skip to content

Commit 01c1e5a

Browse files
author
Devdutt Shenoi
committed
fix: add json only if
1 parent 1d94ae7 commit 01c1e5a

File tree

1 file changed

+14
-12
lines changed
  • src/handlers/http/cluster

1 file changed

+14
-12
lines changed

src/handlers/http/cluster/mod.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,22 @@ pub async fn sync_streams_with_ingestors(
8989
base_path_without_preceding_slash(),
9090
stream_name
9191
);
92-
let res = HTTP_CLIENT
92+
let mut req = HTTP_CLIENT
9393
.put(url)
9494
.headers(reqwest_headers.clone())
95-
.header(header::AUTHORIZATION, &ingestor.token)
96-
.json(&static_schema)
97-
.send()
98-
.await
99-
.map_err(|err| {
100-
error!(
101-
"Fatal: failed to forward upsert stream request to ingestor: {}\n Error: {:?}",
102-
ingestor.domain_name, err
103-
);
104-
StreamError::Network(err)
105-
})?;
95+
.header(header::AUTHORIZATION, &ingestor.token);
96+
97+
if let Some(schema) = static_schema.as_ref() {
98+
req = req.json(schema);
99+
}
100+
101+
let res = req.send().await.map_err(|err| {
102+
error!(
103+
"Fatal: failed to forward upsert stream request to ingestor: {}\n Error: {:?}",
104+
ingestor.domain_name, err
105+
);
106+
StreamError::Network(err)
107+
})?;
106108

107109
if !res.status().is_success() {
108110
error!(

0 commit comments

Comments
 (0)