pub struct Request { /* private fields */ }Expand description
An HTTP request.
Implementations§
Source§impl Request
impl Request
Sourcepub fn with_payload(payload: Payload) -> Request
pub fn with_payload(payload: Payload) -> Request
Creates a request with the supplied payload.
Sourcepub fn head(&self) -> &RequestHead
pub fn head(&self) -> &RequestHead
Returns the request head.
Sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Returns mutable access to the request headers.
Sourcepub fn io(&self) -> Option<&IoRef>
pub fn io(&self) -> Option<&IoRef>
Returns the I/O object for the current connection, when available.
Sourcepub fn peer_addr(&self) -> Option<SocketAddr>
pub fn peer_addr(&self) -> Option<SocketAddr>
Returns the peer socket address.
Peer address is actual socket address, if proxy is used in front of ntex http server, then peer address would be address of this proxy.
Sourcepub fn take_payload(&mut self) -> Payload
pub fn take_payload(&mut self) -> Payload
Takes the request payload, leaving an empty payload behind.
Sourcepub fn replace_payload(&mut self, payload: Payload) -> Payload
pub fn replace_payload(&mut self, payload: Payload) -> Payload
Replaces the request payload and returns the previous value.
Sourcepub fn extensions(&self) -> Ref<'_, Extensions>
pub fn extensions(&self) -> Ref<'_, Extensions>
Returns the request extensions.
Sourcepub fn extensions_mut(&self) -> RefMut<'_, Extensions>
pub fn extensions_mut(&self) -> RefMut<'_, Extensions>
Returns mutable access to the request extensions.
Trait Implementations§
Source§impl HttpMessage for Request
impl HttpMessage for Request
Source§fn message_extensions(&self) -> Ref<'_, Extensions>
fn message_extensions(&self) -> Ref<'_, Extensions>
Request extensions
Source§fn message_extensions_mut(&self) -> RefMut<'_, Extensions>
fn message_extensions_mut(&self) -> RefMut<'_, Extensions>
Mutable reference to a the request’s extensions
Source§fn message_headers(&self) -> &HeaderMap
fn message_headers(&self) -> &HeaderMap
Returns the message headers.
Source§fn content_type(&self) -> &str
fn content_type(&self) -> &str
Returns the media type from the
Content-Type header. Read moreSource§fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>
fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>
Returns the character encoding declared by
Content-Type. Read moreSource§fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>
fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>
Parses the
Content-Type header as a MIME type. Read moreParses and caches cookies from the
Cookie headers. Read moreReturns the first request cookie with the given name.
Source§impl<St, F> Service<St, Request> for AppService<St, F>where
St: State,
F: Service<St, WebRequest<()>, Res = WebResponse, Error = WebError<St, St::Error>>,
impl<St, F> Service<St, Request> for AppService<St, F>where
St: State,
F: Service<St, WebRequest<()>, Res = WebResponse, Error = WebError<St, St::Error>>,
Source§type Error = <F as Service<St, WebRequest>>::Error
type Error = <F as Service<St, WebRequest>>::Error
Error produced while checking readiness or processing a request.
Source§async fn ready(&self, ctx: Ctx<'_, Self, St>) -> Result<(), Self::Error>
async fn ready(&self, ctx: Ctx<'_, Self, St>) -> Result<(), Self::Error>
Waits until the service is ready to process a request. Read more
Source§async fn call(
&self,
req: Request,
ctx: Ctx<'_, Self, St>,
) -> Result<Self::Res, F::Error>
async fn call( &self, req: Request, ctx: Ctx<'_, Self, St>, ) -> Result<Self::Res, F::Error>
Processes a request and asynchronously returns the response. Read more
Source§fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
Maps this service’s output to a different type, returning a new service. Read more
Source§fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
Maps this service’s error to a different type, returning a new service. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for Request
impl !Send for Request
impl !Sync for Request
impl !UnwindSafe for Request
impl Freeze for Request
impl Unpin for Request
impl UnsafeUnpin for Request
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more