mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-20 15:11:45 +03:00
Merge pull request #96 from uqbar-dao/da/http-client-fix
http-client-fix
This commit is contained in:
commit
f0225458dc
@ -136,38 +136,36 @@ async fn handle_message(
|
|||||||
|
|
||||||
match client.execute(request).await {
|
match client.execute(request).await {
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
if expects_response.is_some() {
|
let _ = send_to_loop
|
||||||
let _ = send_to_loop
|
.send(KernelMessage {
|
||||||
.send(KernelMessage {
|
id,
|
||||||
id,
|
source: Address {
|
||||||
source: Address {
|
node: our.to_string(),
|
||||||
node: our.to_string(),
|
process: ProcessId::new(Some("http_client"), "sys", "uqbar"),
|
||||||
process: ProcessId::new(Some("http_client"), "sys", "uqbar"),
|
},
|
||||||
|
target,
|
||||||
|
rsvp: None,
|
||||||
|
message: Message::Response((
|
||||||
|
Response {
|
||||||
|
inherit: false,
|
||||||
|
ipc: serde_json::to_vec::<Result<HttpResponse, HttpClientError>>(&Ok(
|
||||||
|
HttpResponse {
|
||||||
|
status: response.status().as_u16(),
|
||||||
|
headers: serialize_headers(response.headers()),
|
||||||
|
},
|
||||||
|
))
|
||||||
|
.unwrap(),
|
||||||
|
metadata: None,
|
||||||
},
|
},
|
||||||
target,
|
None,
|
||||||
rsvp: None,
|
)),
|
||||||
message: Message::Response((
|
payload: Some(Payload {
|
||||||
Response {
|
mime: None,
|
||||||
inherit: false,
|
bytes: response.bytes().await.unwrap_or_default().to_vec(),
|
||||||
ipc: serde_json::to_vec::<Result<HttpResponse, HttpClientError>>(
|
}),
|
||||||
&Ok(HttpResponse {
|
signed_capabilities: None,
|
||||||
status: response.status().as_u16(),
|
})
|
||||||
headers: serialize_headers(response.headers()),
|
.await;
|
||||||
}),
|
|
||||||
)
|
|
||||||
.unwrap(),
|
|
||||||
metadata: None,
|
|
||||||
},
|
|
||||||
None,
|
|
||||||
)),
|
|
||||||
payload: Some(Payload {
|
|
||||||
mime: None,
|
|
||||||
bytes: response.bytes().await.unwrap_or_default().to_vec(),
|
|
||||||
}),
|
|
||||||
signed_capabilities: None,
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
make_error_message(
|
make_error_message(
|
||||||
|
Loading…
Reference in New Issue
Block a user