mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 13:10:06 +01:00
Merge #1428
1428: Accept any content type as json r=curquiza a=irevoire Co-authored-by: Tamo <tamo@meilisearch.com>
This commit is contained in:
commit
768987583a
@ -33,11 +33,15 @@ guard_content_type!(guard_json, "application/json");
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
fn guard_json(head: &actix_web::dev::RequestHead) -> bool {
|
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
|
content_type
|
||||||
.to_str()
|
.to_str()
|
||||||
.map(|v| v.contains("application/json"))
|
.map(|v| v.contains("application/json"))
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
// if no content-type is specified we still accept the data as json!
|
// if no content-type is specified we still accept the data as json!
|
||||||
true
|
true
|
||||||
|
@ -57,6 +57,7 @@ async fn add_documents_test_no_content_types() {
|
|||||||
|
|
||||||
/// any other content-type is must be refused
|
/// any other content-type is must be refused
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
|
#[ignore]
|
||||||
async fn add_documents_test_bad_content_types() {
|
async fn add_documents_test_bad_content_types() {
|
||||||
let document = json!([
|
let document = json!([
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user