mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 12:54:26 +01:00
add the content type in the webhook + improve the test
This commit is contained in:
parent
f4a6261dea
commit
b130917933
@ -1395,7 +1395,9 @@ impl IndexScheduler {
|
||||
|
||||
// let reader = GzEncoder::new(BufReader::new(task_reader), Compression::default());
|
||||
let reader = GzEncoder::new(BufReader::new(task_reader), Compression::default());
|
||||
let request = ureq::post(url).set("Content-Encoding", "gzip");
|
||||
let request = ureq::post(url)
|
||||
.set("Content-Encoding", "gzip")
|
||||
.set("Content-Type", "application/x-ndjson");
|
||||
let request = match &self.webhook_authorization_header {
|
||||
Some(header) => request.set("Authorization", header),
|
||||
None => request,
|
||||
|
@ -7,7 +7,7 @@ use std::sync::Arc;
|
||||
use actix_http::body::MessageBody;
|
||||
use actix_web::dev::{ServiceFactory, ServiceResponse};
|
||||
use actix_web::web::{Bytes, Data};
|
||||
use actix_web::{post, App, HttpResponse, HttpServer};
|
||||
use actix_web::{post, App, HttpRequest, HttpResponse, HttpServer};
|
||||
use meili_snap::{json_string, snapshot};
|
||||
use meilisearch::Opt;
|
||||
use tokio::sync::mpsc;
|
||||
@ -17,7 +17,17 @@ use crate::common::{default_settings, Server};
|
||||
use crate::json;
|
||||
|
||||
#[post("/")]
|
||||
async fn forward_body(sender: Data<mpsc::UnboundedSender<Vec<u8>>>, body: Bytes) -> HttpResponse {
|
||||
async fn forward_body(
|
||||
req: HttpRequest,
|
||||
sender: Data<mpsc::UnboundedSender<Vec<u8>>>,
|
||||
body: Bytes,
|
||||
) -> HttpResponse {
|
||||
let headers = req.headers();
|
||||
assert_eq!(headers.get("content-type").unwrap(), "application/x-ndjson");
|
||||
assert_eq!(headers.get("transfer-encoding").unwrap(), "chunked");
|
||||
assert_eq!(headers.get("accept-encoding").unwrap(), "gzip");
|
||||
assert_eq!(headers.get("content-encoding").unwrap(), "gzip");
|
||||
|
||||
let body = body.to_vec();
|
||||
sender.send(body).unwrap();
|
||||
HttpResponse::Ok().into()
|
||||
|
Loading…
Reference in New Issue
Block a user