mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 16:51:01 +00:00
makes the content-type mandatory for every routes
This commit is contained in:
@ -181,9 +181,24 @@ async fn document_addition(
|
||||
Some("application/x-ndjson") => DocumentAdditionFormat::Ndjson,
|
||||
Some("text/csv") => DocumentAdditionFormat::Csv,
|
||||
Some(other) => {
|
||||
return Err(MeilisearchHttpError::InvalidContentType(other.to_string()).into())
|
||||
return Err(MeilisearchHttpError::InvalidContentType(
|
||||
other.to_string(),
|
||||
vec![
|
||||
"application/json".to_string(),
|
||||
"application/x-ndjson".to_string(),
|
||||
"application/csv".to_string(),
|
||||
],
|
||||
)
|
||||
.into())
|
||||
}
|
||||
None => {
|
||||
return Err(MeilisearchHttpError::MissingContentType(vec![
|
||||
"application/json".to_string(),
|
||||
"application/x-ndjson".to_string(),
|
||||
"application/csv".to_string(),
|
||||
])
|
||||
.into())
|
||||
}
|
||||
None => return Err(MeilisearchHttpError::MissingContentType.into()),
|
||||
};
|
||||
|
||||
let update = Update::DocumentAddition {
|
||||
|
Reference in New Issue
Block a user