mirror of
https://github.com/fafhrd91/actix-web
synced 2025-07-01 16:55:08 +02:00
remove actix_http::http
module (#2488)
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
use std::{
|
||||
cmp,
|
||||
convert::TryFrom,
|
||||
convert::TryFrom as _,
|
||||
future::Future,
|
||||
marker::PhantomData,
|
||||
pin::Pin,
|
||||
@ -12,7 +12,7 @@ use std::{
|
||||
use actix_http::{
|
||||
body::{EitherBody, MessageBody},
|
||||
encoding::Encoder,
|
||||
http::header::{ContentEncoding, ACCEPT_ENCODING},
|
||||
header::{ContentEncoding, ACCEPT_ENCODING},
|
||||
StatusCode,
|
||||
};
|
||||
use actix_service::{Service, Transform};
|
||||
|
@ -102,7 +102,10 @@ mod tests {
|
||||
use crate::{
|
||||
dev::{ServiceRequest, ServiceResponse},
|
||||
error::Result,
|
||||
http::{header::CONTENT_TYPE, HeaderValue, StatusCode},
|
||||
http::{
|
||||
header::{HeaderValue, CONTENT_TYPE},
|
||||
StatusCode,
|
||||
},
|
||||
middleware::err_handlers::*,
|
||||
test::{self, TestRequest},
|
||||
HttpResponse,
|
||||
|
@ -9,16 +9,14 @@ use std::{
|
||||
task::{Context, Poll},
|
||||
};
|
||||
|
||||
use actix_http::error::HttpError;
|
||||
use actix_utils::future::{ready, Ready};
|
||||
use futures_core::ready;
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
use crate::{
|
||||
dev::{Service, Transform},
|
||||
http::{
|
||||
header::{HeaderName, HeaderValue, CONTENT_TYPE},
|
||||
Error as HttpError, HeaderMap,
|
||||
},
|
||||
http::header::{HeaderMap, HeaderName, HeaderValue, CONTENT_TYPE},
|
||||
service::{ServiceRequest, ServiceResponse},
|
||||
Error,
|
||||
};
|
||||
|
@ -37,19 +37,20 @@ type ErrorHandler<B> = dyn Fn(ServiceResponse<B>) -> Result<ErrorHandlerResponse
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// use actix_web::middleware::{ErrorHandlers, ErrorHandlerResponse};
|
||||
/// use actix_web::{web, http, dev, App, HttpRequest, HttpResponse, Result};
|
||||
/// use actix_web::{web, dev, App, HttpRequest, HttpResponse, Result};
|
||||
/// use actix_web::http::{StatusCode, header};
|
||||
///
|
||||
/// fn render_500<B>(mut res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
||||
/// res.response_mut()
|
||||
/// .headers_mut()
|
||||
/// .insert(http::header::CONTENT_TYPE, http::HeaderValue::from_static("Error"));
|
||||
/// .insert(header::CONTENT_TYPE, header::HeaderValue::from_static("Error"));
|
||||
/// Ok(ErrorHandlerResponse::Response(res))
|
||||
/// }
|
||||
///
|
||||
/// let app = App::new()
|
||||
/// .wrap(
|
||||
/// ErrorHandlers::new()
|
||||
/// .handler(http::StatusCode::INTERNAL_SERVER_ERROR, render_500),
|
||||
/// .handler(StatusCode::INTERNAL_SERVER_ERROR, render_500),
|
||||
/// )
|
||||
/// .service(web::resource("/test")
|
||||
/// .route(web::get().to(|| HttpResponse::Ok()))
|
||||
@ -182,7 +183,10 @@ mod tests {
|
||||
use futures_util::future::FutureExt as _;
|
||||
|
||||
use super::*;
|
||||
use crate::http::{header::CONTENT_TYPE, HeaderValue, StatusCode};
|
||||
use crate::http::{
|
||||
header::{HeaderValue, CONTENT_TYPE},
|
||||
StatusCode,
|
||||
};
|
||||
use crate::test::{self, TestRequest};
|
||||
use crate::HttpResponse;
|
||||
|
||||
|
@ -23,7 +23,7 @@ use time::{format_description::well_known::Rfc3339, OffsetDateTime};
|
||||
|
||||
use crate::{
|
||||
body::{BodySize, MessageBody},
|
||||
http::HeaderName,
|
||||
http::header::HeaderName,
|
||||
service::{ServiceRequest, ServiceResponse},
|
||||
Error, HttpResponse, Result,
|
||||
};
|
||||
@ -126,7 +126,8 @@ impl Logger {
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use actix_web::{http::HeaderValue, middleware::Logger};
|
||||
/// # use actix_web::http::{header::HeaderValue};
|
||||
/// # use actix_web::middleware::Logger;
|
||||
/// # fn parse_jwt_id (_req: Option<&HeaderValue>) -> String { "jwt_uid".to_owned() }
|
||||
/// Logger::new("example %{JWT_ID}xi")
|
||||
/// .custom_request_replace("JWT_ID", |req| parse_jwt_id(req.headers().get("Authorization")));
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! For middleware documentation, see [`NormalizePath`].
|
||||
|
||||
use actix_http::http::{PathAndQuery, Uri};
|
||||
use actix_http::uri::{PathAndQuery, Uri};
|
||||
use actix_service::{Service, Transform};
|
||||
use actix_utils::future::{ready, Ready};
|
||||
use bytes::Bytes;
|
||||
|
Reference in New Issue
Block a user