mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
empty content type error
This commit is contained in:
parent
e400ae900d
commit
137272b8de
3 changed files with 24 additions and 3 deletions
|
@ -10,7 +10,7 @@ use serde::Deserialize;
|
|||
use serde_json::Value;
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use crate::error::ResponseError;
|
||||
use crate::error::{MeilisearchHttpError, ResponseError};
|
||||
use crate::extractors::authentication::{policies::*, GuardedData};
|
||||
use crate::extractors::payload::Payload;
|
||||
use crate::routes::IndexParam;
|
||||
|
@ -66,7 +66,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
|||
.route(
|
||||
web::post()
|
||||
.guard(empty_application_type)
|
||||
.to(HttpResponse::UnsupportedMediaType),
|
||||
.to(missing_content_type_error),
|
||||
)
|
||||
.route(web::post().guard(guard_json).to(add_documents_json))
|
||||
.route(web::post().guard(guard_ndjson).to(add_documents_ndjson))
|
||||
|
@ -76,7 +76,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
|||
.route(
|
||||
web::put()
|
||||
.guard(empty_application_type)
|
||||
.to(HttpResponse::UnsupportedMediaType),
|
||||
.to(missing_content_type_error),
|
||||
)
|
||||
.route(web::put().guard(guard_json).to(update_documents_json))
|
||||
.route(web::put().guard(guard_ndjson).to(update_documents_ndjson))
|
||||
|
@ -93,6 +93,10 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
|||
);
|
||||
}
|
||||
|
||||
async fn missing_content_type_error() -> Result<HttpResponse, ResponseError> {
|
||||
Err(MeilisearchHttpError::MissingContentType.into())
|
||||
}
|
||||
|
||||
pub async fn get_document(
|
||||
meilisearch: GuardedData<Public, MeiliSearch>,
|
||||
path: web::Path<DocumentParam>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue