Closed nanakura closed 2 months ago
I made some attempts
use futures::TryStreamExt; use ntex::web; #[web::get("/")] async fn hello(body: web::types::Payload) -> impl web::Responder { let reader = body.into_async_read(); web::HttpResponse::Ok().finish() } #[ntex::main] async fn main() -> std::io::Result<()> { web::HttpServer::new(|| { web::App::new() .service(hello) }) .bind(("127.0.0.1", 8080))? .run() .await }
I get the following error
error[E0271]: type mismatch resolving `<Payload as Stream>::Item == Result<Bytes, Error>` --> src\main.rs:6:23 | 6 | let reader = body.into_async_read(); | ^^^^^^^^^^^^^^^ expected `Result<Bytes, Error>`, found `Result<Bytes, PayloadError>` | = note: expected enum `Result<_, std::io::Error>` found enum `Result<_, ntex::http::error::PayloadError>` = note: required for `ntex::web::types::Payload` to implement `TryStream` note: required by a bound in `into_async_read`
I tried implementing it manually
I made some attempts
I get the following error