invalid content type error

This commit is contained in:
mpostma 2021-09-30 11:17:42 +02:00 committed by Tamo
parent ddd40d87a7
commit 18cb514073
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
4 changed files with 41 additions and 140 deletions

View file

@ -13,12 +13,15 @@ use serde::{Deserialize, Serialize};
pub enum MeilisearchHttpError {
#[error("A Content-Type header is missing. Accepted values for the Content-Type header are: \"application/json\", \"application/x-ndjson\", \"test/csv\"")]
MissingContentType,
#[error("The Content-Type \"{0}\" is invalid. Accepted values for the Content-Type header are: \"application/json\", \"application/x-ndjson\", \"test/csv\"")]
InvalidContentType(String),
}
impl ErrorCode for MeilisearchHttpError {
fn error_code(&self) -> Code {
match self {
MeilisearchHttpError::MissingContentType => Code::MissingContentType,
MeilisearchHttpError::InvalidContentType(_) => Code::InvalidContentType,
}
}
}