From 4aa7d386d8c91ff48316e037206ff12f921d502a Mon Sep 17 00:00:00 2001 From: Tamo Date: Mon, 8 Jul 2024 19:43:21 +0200 Subject: [PATCH] remove http and uses actix_web::http instead --- Cargo.lock | 1 - meilisearch/Cargo.toml | 1 - meilisearch/src/analytics/segment_analytics.rs | 3 +-- meilisearch/src/lib.rs | 4 ++-- meilisearch/tests/auth/errors.rs | 2 +- meilisearch/tests/documents/get_documents.rs | 2 +- meilisearch/tests/index/create_index.rs | 3 +-- 7 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba1783ad2..62564200c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3349,7 +3349,6 @@ dependencies = [ "futures", "futures-util", "hex", - "http 0.2.12", "index-scheduler", "indexmap", "insta", diff --git a/meilisearch/Cargo.toml b/meilisearch/Cargo.toml index 48da3e475..52f0cf6b7 100644 --- a/meilisearch/Cargo.toml +++ b/meilisearch/Cargo.toml @@ -47,7 +47,6 @@ flate2 = "1.0.30" fst = "0.4.7" futures = "0.3.30" futures-util = "0.3.30" -http = "0.2.11" index-scheduler = { path = "../index-scheduler" } indexmap = { version = "2.2.6", features = ["serde"] } is-terminal = "0.4.12" diff --git a/meilisearch/src/analytics/segment_analytics.rs b/meilisearch/src/analytics/segment_analytics.rs index 94e4684d5..67f437082 100644 --- a/meilisearch/src/analytics/segment_analytics.rs +++ b/meilisearch/src/analytics/segment_analytics.rs @@ -5,10 +5,9 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; use std::time::{Duration, Instant}; -use actix_web::http::header::USER_AGENT; +use actix_web::http::header::{CONTENT_TYPE, USER_AGENT}; use actix_web::HttpRequest; use byte_unit::Byte; -use http::header::CONTENT_TYPE; use index_scheduler::IndexScheduler; use meilisearch_auth::{AuthController, AuthFilter}; use meilisearch_types::InstanceUid; diff --git a/meilisearch/src/lib.rs b/meilisearch/src/lib.rs index bb7562c85..2af103593 100644 --- a/meilisearch/src/lib.rs +++ b/meilisearch/src/lib.rs @@ -23,13 +23,13 @@ use actix_cors::Cors; use actix_http::body::MessageBody; use actix_web::dev::{ServiceFactory, ServiceResponse}; use actix_web::error::JsonPayloadError; +use actix_web::http::header::{CONTENT_TYPE, USER_AGENT}; use actix_web::web::Data; use actix_web::{web, HttpRequest}; use analytics::Analytics; use anyhow::bail; use error::PayloadError; use extractors::payload::PayloadConfig; -use http::header::CONTENT_TYPE; use index_scheduler::{IndexScheduler, IndexSchedulerOptions}; use meilisearch_auth::AuthController; use meilisearch_types::milli::documents::{DocumentsBatchBuilder, DocumentsBatchReader}; @@ -167,7 +167,7 @@ impl tracing_actix_web::RootSpanBuilder for AwebTracingLogger { let conn_info = request.connection_info(); let headers = request.headers(); let user_agent = headers - .get(http::header::USER_AGENT) + .get(USER_AGENT) .map(|value| String::from_utf8_lossy(value.as_bytes()).into_owned()) .unwrap_or_default(); info_span!("HTTP request", method = %request.method(), host = conn_info.host(), route = %request.path(), query_parameters = %request.query_string(), %user_agent, status_code = Empty, error = Empty) diff --git a/meilisearch/tests/auth/errors.rs b/meilisearch/tests/auth/errors.rs index 466eefe65..c063b2aac 100644 --- a/meilisearch/tests/auth/errors.rs +++ b/meilisearch/tests/auth/errors.rs @@ -1,5 +1,5 @@ +use actix_web::http::StatusCode; use actix_web::test; -use http::StatusCode; use jsonwebtoken::{EncodingKey, Header}; use meili_snap::*; use uuid::Uuid; diff --git a/meilisearch/tests/documents/get_documents.rs b/meilisearch/tests/documents/get_documents.rs index efe4cf8e9..68065b019 100644 --- a/meilisearch/tests/documents/get_documents.rs +++ b/meilisearch/tests/documents/get_documents.rs @@ -1,5 +1,5 @@ +use actix_web::http::header::ACCEPT_ENCODING; use actix_web::test; -use http::header::ACCEPT_ENCODING; use meili_snap::*; use urlencoding::encode as urlencode; diff --git a/meilisearch/tests/index/create_index.rs b/meilisearch/tests/index/create_index.rs index b309b83c6..b51ccab51 100644 --- a/meilisearch/tests/index/create_index.rs +++ b/meilisearch/tests/index/create_index.rs @@ -1,6 +1,5 @@ -use actix_web::http::header::ContentType; +use actix_web::http::header::{ContentType, ACCEPT_ENCODING}; use actix_web::test; -use http::header::ACCEPT_ENCODING; use meili_snap::{json_string, snapshot}; use meilisearch::Opt;