From 2830853665a20f751389fb109802bbb1609348fc Mon Sep 17 00:00:00 2001 From: Tamo Date: Wed, 30 Jun 2021 17:05:59 +0200 Subject: [PATCH] accept any content type as json --- meilisearch-http/src/routes/document.rs | 6 +++++- meilisearch-http/tests/documents/add_documents.rs | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/meilisearch-http/src/routes/document.rs b/meilisearch-http/src/routes/document.rs index 418c67462..112467f67 100644 --- a/meilisearch-http/src/routes/document.rs +++ b/meilisearch-http/src/routes/document.rs @@ -33,11 +33,15 @@ guard_content_type!(guard_json, "application/json"); */ fn guard_json(head: &actix_web::dev::RequestHead) -> bool { - if let Some(content_type) = head.headers.get("Content-Type") { + if let Some(_content_type) = head.headers.get("Content-Type") { + // CURRENTLY AND FOR THIS RELEASE ONLY WE DECIDED TO INTERPRET ALL CONTENT-TYPES AS JSON + true + /* content_type .to_str() .map(|v| v.contains("application/json")) .unwrap_or(false) + */ } else { // if no content-type is specified we still accept the data as json! true diff --git a/meilisearch-http/tests/documents/add_documents.rs b/meilisearch-http/tests/documents/add_documents.rs index 66e475172..4c94cf194 100644 --- a/meilisearch-http/tests/documents/add_documents.rs +++ b/meilisearch-http/tests/documents/add_documents.rs @@ -57,6 +57,7 @@ async fn add_documents_test_no_content_types() { /// any other content-type is must be refused #[actix_rt::test] +#[ignore] async fn add_documents_test_bad_content_types() { let document = json!([ {