Added support for specifying compression in tests

Refactored tests code to allow to specify compression (content-encoding) algorithm.

Added tests to verify what actix actually handle different content encodings properly.
This commit is contained in:
Andrey "MOU" Larionov 2022-10-09 19:43:51 +02:00
parent 7607a62531
commit 11b986a81d
No known key found for this signature in database
GPG key ID: 5FF293FC94C01D6A
9 changed files with 224 additions and 128 deletions

View file

@ -12,6 +12,7 @@ use once_cell::sync::Lazy;
use serde_json::Value;
use tempfile::TempDir;
use crate::common::encoder::Encoder;
use meilisearch_http::option::Opt;
use super::index::Index;
@ -100,9 +101,14 @@ impl Server {
/// Returns a view to an index. There is no guarantee that the index exists.
pub fn index(&self, uid: impl AsRef<str>) -> Index<'_> {
self.index_with_encoder(uid, Encoder::Plain)
}
pub fn index_with_encoder(&self, uid: impl AsRef<str>, encoder: Encoder) -> Index<'_> {
Index {
uid: uid.as_ref().to_string(),
service: &self.service,
encoder,
}
}