Struct actix_http::Request
source · pub struct Request<P = BoxedPayloadStream> { /* private fields */ }
Expand description
An HTTP request.
Implementations§
source§impl Request<BoxedPayloadStream>
impl Request<BoxedPayloadStream>
sourcepub fn new() -> Request<BoxedPayloadStream>
pub fn new() -> Request<BoxedPayloadStream>
Create new Request instance
source§impl<P> Request<P>
impl<P> Request<P>
sourcepub fn with_payload(payload: Payload<P>) -> Request<P>
pub fn with_payload(payload: Payload<P>) -> Request<P>
Create new Request instance
sourcepub fn replace_payload<P1>(
self,
payload: Payload<P1>,
) -> (Request<P1>, Payload<P>)
pub fn replace_payload<P1>( self, payload: Payload<P1>, ) -> (Request<P1>, Payload<P>)
Create new Request instance
sourcepub fn take_payload(&mut self) -> Payload<P>
pub fn take_payload(&mut self) -> Payload<P>
Get request’s payload
sourcepub fn into_parts(self) -> (Message<RequestHead>, Payload<P>)
pub fn into_parts(self) -> (Message<RequestHead>, Payload<P>)
Split request into request head and payload
sourcepub fn head(&self) -> &RequestHead
pub fn head(&self) -> &RequestHead
Http message part of the request
sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Mutable reference to the message’s headers.
sourcepub fn peer_addr(&self) -> Option<SocketAddr>
pub fn peer_addr(&self) -> Option<SocketAddr>
Peer socket address.
Peer address is the directly connected peer’s socket address. If a proxy is used in front of the Actix Web server, then it would be address of this proxy.
Will only return None when called in unit tests unless set manually.
sourcepub fn conn_data<T: 'static>(&self) -> Option<&T>
pub fn conn_data<T: 'static>(&self) -> Option<&T>
Returns a reference a piece of connection data set in an on-connect callback.
let opt_t = req.conn_data::<PeerCertificate>();
sourcepub fn take_conn_data(&mut self) -> Option<Rc<Extensions>>
pub fn take_conn_data(&mut self) -> Option<Rc<Extensions>>
Returns the connection-level data/extensions container if an on-connect callback was registered, leaving an empty one in its place.
sourcepub fn take_req_data(&mut self) -> Extensions
pub fn take_req_data(&mut self) -> Extensions
Returns the request-local data/extensions container, leaving an empty one in its place.
Trait Implementations§
source§impl From<Message<RequestHead>> for Request<BoxedPayloadStream>
impl From<Message<RequestHead>> for Request<BoxedPayloadStream>
source§fn from(head: Message<RequestHead>) -> Self
fn from(head: Message<RequestHead>) -> Self
source§impl<P> HttpMessage for Request<P>
impl<P> HttpMessage for Request<P>
source§fn take_payload(&mut self) -> Payload<P>
fn take_payload(&mut self) -> Payload<P>
source§fn extensions(&self) -> Ref<'_, Extensions>
fn extensions(&self) -> Ref<'_, Extensions>
source§fn extensions_mut(&self) -> RefMut<'_, Extensions>
fn extensions_mut(&self) -> RefMut<'_, Extensions>
source§fn content_type(&self) -> &str
fn content_type(&self) -> &str
source§fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>
fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>
source§impl Service<Request> for ExpectHandler
impl Service<Request> for ExpectHandler
source§type Future = Ready<Result<<ExpectHandler as Service<Request>>::Response, <ExpectHandler as Service<Request>>::Error>>
type Future = Ready<Result<<ExpectHandler as Service<Request>>::Response, <ExpectHandler as Service<Request>>::Error>>
source§impl ServiceFactory<Request> for ExpectHandler
impl ServiceFactory<Request> for ExpectHandler
source§type Service = ExpectHandler
type Service = ExpectHandler
Service
created by this factory.source§type Future = Ready<Result<<ExpectHandler as ServiceFactory<Request>>::Service, <ExpectHandler as ServiceFactory<Request>>::InitError>>
type Future = Ready<Result<<ExpectHandler as ServiceFactory<Request>>::Service, <ExpectHandler as ServiceFactory<Request>>::InitError>>
Service
instance.g