From cc7e295e8891a5366260f1b48b89a21698006748 Mon Sep 17 00:00:00 2001 From: orhun Date: Fri, 23 Jul 2021 23:07:47 +0300 Subject: [PATCH] refactor(server): use 400 bad request for invalid content --- src/header.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/header.rs b/src/header.rs index f7d1b3e..7f9f7cb 100644 --- a/src/header.rs +++ b/src/header.rs @@ -18,9 +18,7 @@ impl TryFrom> for ContentDisposition { fn try_from(content_disposition: Option) -> Result { match content_disposition { Some(inner) => Ok(Self { inner }), - None => Err(error::ErrorUnprocessableEntity( - "content disposition does not exist", - )), + None => Err(error::ErrorBadRequest("content disposition does not exist")), } } } @@ -44,6 +42,6 @@ impl ContentDisposition { .find(|param| param.is_filename()) .map(|param| param.as_filename()) .flatten() - .ok_or_else(|| error::ErrorUnprocessableEntity("file data not present")) + .ok_or_else(|| error::ErrorBadRequest("file data not present")) } }