-
Hi, I have a similar request as #635. related code: let mut response = client::Client::default() ‣mut response: ClientResponse<Decoder<Payload>> ‣Client
.get(this_req) ‣ClientRequest
.header("User-Agent", "Actix-web") ‣ClientRequest
.send() ‣SendClientRequest
.await?;
let data = response.json().await?;
log::info!("{:#?}", data); the error: curl -X POST -H "Content-Type: application/json" --url http://127.0.0.1:8080/xx -d '{"code":"xxx"}'
# normally it should be (in bytes format)
[2021-07-10T05:41:51Z INFO x::http] "{\"errcode\":41129,\"errmsg\":\"invalid code, hints: [ req_id: xxx ]\"}"
# but instead
[2021-07-10T05:56:26Z ERROR actix_http::response] Internal Server Error: ContentType I also noticed the newest paradox text in documentation. |
Beta Was this translation helpful? Give feedback.
Answered by
robjtede
Jul 10, 2021
Replies: 1 comment
-
Just get the body bytes with .body instead of .json and use serde_json::from_slice. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just get the body bytes with .body instead of .json and use serde_json::from_slice.