Skip to content

Commit 782fac0

Browse files
committed
Check Status Code from external Notus call
1 parent c1e1661 commit 782fac0

File tree

1 file changed

+9
-0
lines changed
  • rust/src/nasl/builtin/notus

1 file changed

+9
-0
lines changed

rust/src/nasl/builtin/notus/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ mod tests;
88
use std::{collections::HashMap, net::SocketAddr};
99

1010
use greenbone_scanner_framework::models::FixedVersion;
11+
use http::StatusCode;
1112
use nasl_function_proc_macro::nasl_function;
1213
use serde::{Deserialize, Serialize};
1314
use serde_json;
@@ -76,6 +77,14 @@ impl NaslNotus {
7677
.await
7778
.map_err(|e| HttpError::Custom(e.to_string()))?;
7879

80+
if response.status() != StatusCode::OK {
81+
return Err(HttpError::Custom(format!(
82+
"Notus service returned status code {}",
83+
response.status()
84+
))
85+
.into());
86+
}
87+
7988
// Parse JSON array of results
8089
let results: Vec<NotusResult> = response
8190
.json()

0 commit comments

Comments
 (0)