Skip to content
Discussion options

You must be logged in to vote

Bytes extractor will get any request's body bytes.

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;
   ...
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by robjtede
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants