diff --git a/examples/raw_upload/src/main.rs b/examples/raw_upload/src/main.rs index 3363e41e..59e0df52 100644 --- a/examples/raw_upload/src/main.rs +++ b/examples/raw_upload/src/main.rs @@ -5,15 +5,10 @@ extern crate rocket; use rocket::request::Data; use rocket::response::Failure; -use rocket::http::{StatusCode, ContentType}; - -#[post("/upload", data = "")] -fn upload(content_type: ContentType, data: Data) -> Result { - if !content_type.is_text() { - println!(" => Content-Type of upload must be text. Ignoring."); - return Err(Failure(StatusCode::BadRequest)); - } +use rocket::http::StatusCode; +#[post("/upload", format = "text/plain", data = "")] +fn upload(data: Data) -> Result { match data.stream_to_file("/tmp/upload.txt") { Ok(n) => Ok(format!("OK: {} bytes uploaded.", n)), Err(e) => {