Skip to content

Commit 869ea6d

Browse files
committed
properly handle 400/500 responses on proxy client
Signed-off-by: Lance-Drane <[email protected]>
1 parent 3a5a9f6 commit 869ea6d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

proxy-http-client/src/poster.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ impl HttpBroadcast for Poster {
2929
.body(event)
3030
.send()
3131
.await;
32-
result.is_ok()
32+
if result.is_ok() {
33+
let result = result.unwrap();
34+
let status = result.status().as_u16();
35+
match result.bytes().await {
36+
Ok(bytes) => tracing::debug!("{:?}", bytes),
37+
Err(err) => tracing::debug!("ERROR: {}", err.to_string()),
38+
}
39+
status < 400
40+
} else {
41+
let result = result.unwrap_err();
42+
tracing::error!("response is error {}", result.to_string());
43+
false
44+
}
3345
}
3446
}

0 commit comments

Comments
 (0)