mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-22 04:19:47 -05:00
refactor(server): use 400 bad request for invalid content
This commit is contained in:
parent
53ba3dcac9
commit
cc7e295e88
1 changed files with 2 additions and 4 deletions
|
@ -18,9 +18,7 @@ impl TryFrom<Option<ActixContentDisposition>> for ContentDisposition {
|
||||||
fn try_from(content_disposition: Option<ActixContentDisposition>) -> Result<Self, Self::Error> {
|
fn try_from(content_disposition: Option<ActixContentDisposition>) -> Result<Self, Self::Error> {
|
||||||
match content_disposition {
|
match content_disposition {
|
||||||
Some(inner) => Ok(Self { inner }),
|
Some(inner) => Ok(Self { inner }),
|
||||||
None => Err(error::ErrorUnprocessableEntity(
|
None => Err(error::ErrorBadRequest("content disposition does not exist")),
|
||||||
"content disposition does not exist",
|
|
||||||
)),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +42,6 @@ impl ContentDisposition {
|
||||||
.find(|param| param.is_filename())
|
.find(|param| param.is_filename())
|
||||||
.map(|param| param.as_filename())
|
.map(|param| param.as_filename())
|
||||||
.flatten()
|
.flatten()
|
||||||
.ok_or_else(|| error::ErrorUnprocessableEntity("file data not present"))
|
.ok_or_else(|| error::ErrorBadRequest("file data not present"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue