mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 12:27:13 +02:00
makes the content-type mandatory for every routes
This commit is contained in:
parent
ddbcf449da
commit
c6d107a05f
4 changed files with 61 additions and 14 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue