Skip to content
This repository was archived by the owner on Feb 20, 2024. It is now read-only.

Commit 9c128a6

Browse files
committed
fix: simply cast of unknown err type
1 parent fba3237 commit 9c128a6

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/lib/api_app/src/api/responses.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::str::FromStr;
2+
13
use super::utils::get_default_headers;
24
use http::header::HeaderMap;
35
use http::StatusCode;
@@ -201,10 +203,10 @@ pub fn resolve_external_service_bad_response(
201203
if response_json.is_object() {
202204
let status = response_json
203205
.get("status")
204-
.and_then(|v| v.as_i64())
205-
.unwrap_or(0);
206-
if status != 0 {
207-
status_code = StatusCode::from_u16(status as u16).unwrap_or(status_code);
206+
.and_then(|v| v.as_str())
207+
.unwrap_or("");
208+
if status != "" {
209+
status_code = StatusCode::from_str(status).unwrap_or(status_code);
208210
}
209211
}
210212

0 commit comments

Comments
 (0)