mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 03:47:02 +02:00
Merge #2876
2876: Full support for compressed (Gzip, Brotli, Zlib) API requests r=Kerollmops a=mou # Pull Request ## Related issue Fixes #2802 ## What does this PR do? - Adds missed content-encoding support for streamed requests (documents) - Adds additional tests to validate content-encoding support is in place - Adds new tests to validate content-encoding support for previously existing code (built-in actix functionality for unmarshaling JSON payloads) ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Andrey "MOU" Larionov <anlarionov@gmail.com>
This commit is contained in:
commit
fc5a7e376c
14 changed files with 650 additions and 293 deletions
|
@ -1,13 +1,14 @@
|
|||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
use actix_http::encoding::Decoder as Decompress;
|
||||
use actix_web::error::PayloadError;
|
||||
use actix_web::{dev, web, FromRequest, HttpRequest};
|
||||
use futures::future::{ready, Ready};
|
||||
use futures::Stream;
|
||||
|
||||
pub struct Payload {
|
||||
payload: dev::Payload,
|
||||
payload: Decompress<dev::Payload>,
|
||||
limit: usize,
|
||||
}
|
||||
|
||||
|
@ -39,7 +40,7 @@ impl FromRequest for Payload {
|
|||
.map(|c| c.limit)
|
||||
.unwrap_or(PayloadConfig::default().limit);
|
||||
ready(Ok(Payload {
|
||||
payload: payload.take(),
|
||||
payload: Decompress::from_headers(payload.take(), req.headers()),
|
||||
limit,
|
||||
}))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue