upgrade actix-web to v3

This commit is contained in:
Rob Ede 2020-09-12 03:29:17 +01:00
parent 4acaecd921
commit ba0f44e361
No known key found for this signature in database
GPG key ID: C2A3B36E841A91E6
16 changed files with 649 additions and 444 deletions

View file

@ -4,7 +4,7 @@ use std::rc::Rc;
use std::task::{Context, Poll};
use actix_service::{Service, Transform};
use actix_web::{dev::ServiceRequest, dev::ServiceResponse};
use actix_web::{dev::ServiceRequest, dev::ServiceResponse, web};
use futures::future::{err, ok, Future, Ready};
use crate::error::{Error, ResponseError};
@ -63,7 +63,7 @@ where
let mut svc = self.service.clone();
// This unwrap is left because this error should never appear. If that's the case, then
// it means that actix-web has an issue or someone changes the type `Data`.
let data = req.app_data::<Data>().unwrap();
let data = req.app_data::<web::Data<Data>>().unwrap();
if data.api_keys.master.is_none() {
return Box::pin(svc.call(req));

View file

@ -34,7 +34,7 @@ pub fn create_app(
actix_http::body::Body,
> {
App::new()
.app_data(web::Data::new(data.clone()))
.data(data.clone())
.app_data(
web::JsonConfig::default()
.limit(data.http_payload_size_limit)

View file

@ -14,7 +14,7 @@ mod analytics;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[actix_rt::main]
#[actix_web::main]
async fn main() -> Result<(), MainError> {
let opt = Opt::from_args();

View file

@ -1,7 +1,7 @@
use std::collections::{BTreeSet, HashSet};
use actix_web::{web, HttpResponse};
use actix_web_macros::{delete, get, post, put};
use actix_web::{delete, get, post, put};
use indexmap::IndexMap;
use meilisearch_core::update;
use serde::Deserialize;

View file

@ -1,5 +1,5 @@
use actix_web::{web, HttpResponse};
use actix_web_macros::{get, put};
use actix_web::{get, put};
use serde::Deserialize;
use crate::error::{Error, ResponseError};

View file

@ -1,5 +1,5 @@
use actix_web::{web, HttpResponse};
use actix_web_macros::{delete, get, post, put};
use actix_web::{delete, get, post, put};
use chrono::{DateTime, Utc};
use log::error;
use rand::seq::SliceRandom;

View file

@ -1,6 +1,6 @@
use actix_web::web;
use actix_web::HttpResponse;
use actix_web_macros::get;
use actix_web::get;
use serde::Serialize;
use crate::helpers::Authentication;

View file

@ -3,7 +3,7 @@ use std::collections::{HashSet, HashMap};
use log::warn;
use actix_web::web;
use actix_web::HttpResponse;
use actix_web_macros::{get, post};
use actix_web::{get, post};
use serde::{Deserialize, Serialize};
use serde_json::Value;

View file

@ -1,5 +1,5 @@
use actix_web::{web, HttpResponse};
use actix_web_macros::{delete, get, post};
use actix_web::{delete, get, post};
use meilisearch_core::settings::{Settings, SettingsUpdate, UpdateState, DEFAULT_RANKING_RULES};
use meilisearch_schema::Schema;
use std::collections::{BTreeMap, BTreeSet, HashSet};

View file

@ -2,7 +2,7 @@ use std::collections::HashMap;
use actix_web::web;
use actix_web::HttpResponse;
use actix_web_macros::get;
use actix_web::get;
use chrono::{DateTime, Utc};
use log::error;
use serde::Serialize;

View file

@ -1,5 +1,5 @@
use actix_web::{web, HttpResponse};
use actix_web_macros::{delete, get, post};
use actix_web::{delete, get, post};
use meilisearch_core::settings::{SettingsUpdate, UpdateState};
use std::collections::BTreeSet;

View file

@ -1,7 +1,7 @@
use std::collections::BTreeMap;
use actix_web::{web, HttpResponse};
use actix_web_macros::{delete, get, post};
use actix_web::{delete, get, post};
use indexmap::IndexMap;
use meilisearch_core::settings::{SettingsUpdate, UpdateState};