empty content type error

This commit is contained in:
mpostma 2021-09-30 10:26:30 +02:00 committed by Tamo
parent e400ae900d
commit 137272b8de
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
3 changed files with 24 additions and 3 deletions

View file

@ -9,6 +9,20 @@ use aweb::error::{JsonPayloadError, QueryPayloadError};
use meilisearch_error::{Code, ErrorCode};
use serde::{Deserialize, Serialize};
#[derive(Debug, thiserror::Error)]
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,
}
impl ErrorCode for MeilisearchHttpError {
fn error_code(&self) -> Code {
match self {
MeilisearchHttpError::MissingContentType => Code::MissingContentType,
}
}
}
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ResponseError {