-
|
Hey, i want to upload a file. I found actix multipart and it is working fine, but i was wondering if there is a built-in way to parse an application/octet-stream into bytes? Can someone help me out? Thanks in advance for your time. |
Beta Was this translation helpful? Give feedback.
Answered by
robjtede
Jul 4, 2022
Replies: 1 comment
-
|
Eg: use actix_web::web::Bytes;
#[get("/")]
async fn handler(body: Bytes) -> ... {
...
}You can check for the content type too if you want Eg: use actix_web::{http::header::ContentType, web::{Bytes, Header}};
#[get("/")]
async fn handler(body: Bytes, ct: Header<ContentType>) -> ... {
let mime_type = ct.into_inner().0;
...
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
robjtede
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bytesextractor will get any request's body bytes.Eg:
You can check for the content type too if you want
Eg: