We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4fdb4ef commit 28b9412Copy full SHA for 28b9412
rust/fetcher-rust/src/lib.rs
@@ -50,16 +50,13 @@ pub extern "C" fn rust_fetch(
50
let code = res.status();
51
let body = res.into_string().unwrap_or_default();
52
53
- let is_ok = code < 400;
54
-
55
FetchResult {
56
- ok: is_ok,
+ ok: code < 400,
57
code: code.into(),
58
body: CString::new(body).unwrap().into_raw(),
59
}
60
61
Err(ureq::Error::Status(code, response)) => {
62
- // Здесь у нас есть Response и его body!
63
let body = response
64
.into_string()
65
.unwrap_or_else(|_| "<no body>".to_string());
@@ -71,7 +68,6 @@ pub extern "C" fn rust_fetch(
71
68
72
69
Err(e) => {
73
70
let msg = format!("Request error: {}", e);
74
75
76
ok: false,
77
code: 0,
0 commit comments