1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-23 16:21:06 +01:00

update service request/response location

This commit is contained in:
Nikolay Kim 2019-03-10 16:39:46 -07:00
parent 4d96abb639
commit 0f0d6b65ca
4 changed files with 15 additions and 13 deletions

View File

@ -16,12 +16,12 @@ use percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET};
use v_htmlescape::escape as escape_html_entity;
use actix_service::{boxed::BoxedNewService, NewService, Service};
use actix_web::dev::{CpuFuture, HttpServiceFactory, ResourceDef, ServiceConfig};
use actix_web::error::{BlockingError, Error, ErrorInternalServerError};
use actix_web::{
web, FromRequest, HttpRequest, HttpResponse, Responder, ServiceFromRequest,
use actix_web::dev::{
CpuFuture, HttpServiceFactory, ResourceDef, ServiceConfig, ServiceFromRequest,
ServiceRequest, ServiceResponse,
};
use actix_web::error::{BlockingError, Error, ErrorInternalServerError};
use actix_web::{web, FromRequest, HttpRequest, HttpResponse, Responder};
use futures::future::{ok, FutureResult};
mod config;
@ -34,7 +34,8 @@ pub use crate::config::{DefaultConfig, StaticFileConfig};
pub use crate::named::NamedFile;
pub use crate::range::HttpRange;
type HttpNewService<P> = BoxedNewService<(), ServiceRequest<P>, ServiceResponse, (), ()>;
type HttpNewService<P> =
BoxedNewService<(), ServiceRequest<P>, ServiceResponse, Error, ()>;
/// Return the MIME type associated with a filename extension (case-insensitive).
/// If `ext` is empty or no associated type for the extension was found, returns
@ -319,7 +320,7 @@ where
impl<P, C: StaticFileConfig + 'static> NewService for Files<P, C> {
type Request = ServiceRequest<P>;
type Response = ServiceResponse;
type Error = ();
type Error = Error;
type Service = FilesService<P, C>;
type InitError = ();
type Future = FutureResult<Self::Service, Self::InitError>;
@ -352,7 +353,7 @@ pub struct FilesService<S, C = DefaultConfig> {
impl<P, C: StaticFileConfig> Service for FilesService<P, C> {
type Request = ServiceRequest<P>;
type Response = ServiceResponse;
type Error = ();
type Error = Error;
type Future = FutureResult<Self::Response, Self::Error>;
fn poll_ready(&mut self) -> Poll<(), Self::Error> {

View File

@ -19,8 +19,9 @@ use std::collections::HashMap;
use std::rc::Rc;
use actix_service::{Service, Transform};
use actix_web::dev::{ServiceRequest, ServiceResponse};
use actix_web::http::{header::SET_COOKIE, HeaderValue};
use actix_web::{Error, HttpMessage, ResponseError, ServiceRequest, ServiceResponse};
use actix_web::{Error, HttpMessage, ResponseError};
use cookie::{Cookie, CookieJar, Key, SameSite};
use derive_more::{Display, From};
use futures::future::{ok, Future, FutureResult};

View File

@ -45,8 +45,8 @@
use std::cell::RefCell;
use std::rc::Rc;
use actix_web::dev::{ServiceFromRequest, ServiceRequest, ServiceResponse};
use actix_web::{Error, FromRequest, HttpMessage};
use actix_web::{ServiceFromRequest, ServiceRequest, ServiceResponse};
use hashbrown::HashMap;
use serde::de::DeserializeOwned;
use serde::Serialize;

View File

@ -40,7 +40,7 @@ pub trait FromRequest<P>: Sized {
///
/// ```rust
/// # #[macro_use] extern crate serde_derive;
/// use actix_web::{web, App, Error, FromRequest, ServiceFromRequest};
/// use actix_web::{web, dev, App, Error, FromRequest};
/// use actix_web::error::ErrorBadRequest;
/// use rand;
///
@ -53,7 +53,7 @@ pub trait FromRequest<P>: Sized {
/// type Error = Error;
/// type Future = Result<Self, Self::Error>;
///
/// fn from_request(req: &mut ServiceFromRequest<P>) -> Self::Future {
/// fn from_request(req: &mut dev::ServiceFromRequest<P>) -> Self::Future {
/// if rand::random() {
/// Ok(Thing { name: "thingy".into() })
/// } else {
@ -107,7 +107,7 @@ where
///
/// ```rust
/// # #[macro_use] extern crate serde_derive;
/// use actix_web::{web, App, Result, Error, FromRequest, ServiceFromRequest};
/// use actix_web::{web, dev, App, Result, Error, FromRequest};
/// use actix_web::error::ErrorBadRequest;
/// use rand;
///
@ -120,7 +120,7 @@ where
/// type Error = Error;
/// type Future = Result<Thing, Error>;
///
/// fn from_request(req: &mut ServiceFromRequest<P>) -> Self::Future {
/// fn from_request(req: &mut dev::ServiceFromRequest<P>) -> Self::Future {
/// if rand::random() {
/// Ok(Thing { name: "thingy".into() })
/// } else {