Skip to main content

Request

Struct Request 

Source
pub struct Request { /* private fields */ }
Expand description

Request

Implementations§

Source§

impl Request

Source

pub fn new() -> Request

Create new Request instance

Source§

impl Request

Source

pub fn with_payload(payload: Payload) -> Request

Create new Request instance

Source

pub fn head(&self) -> &RequestHead

Http message part of the request

Source

pub fn uri(&self) -> &Uri

Request’s uri.

Source

pub fn uri_mut(&mut self) -> &mut Uri

Mutable reference to the request’s uri.

Source

pub fn method(&self) -> &Method

Read the Request method.

Source

pub fn version(&self) -> Version

Read the Request Version.

Source

pub fn path(&self) -> &str

The target path of this Request.

Source

pub fn headers(&self) -> &HeaderMap

Request’s headers.

Source

pub fn headers_mut(&mut self) -> &mut HeaderMap

Mutable reference to the message’s headers.

Source

pub fn upgrade(&self) -> bool

Check if request requires connection upgrade

Source

pub fn io(&self) -> Option<&IoRef>

Io reference for current connection

Source

pub fn peer_addr(&self) -> Option<SocketAddr>

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.

Source

pub fn payload(&mut self) -> &mut Payload

Get request’s payload

Source

pub fn take_payload(&mut self) -> Payload

Get request’s payload

Source

pub fn replace_payload(&mut self, payload: Payload) -> Payload

Replace request’s payload, returns old one

Source

pub fn extensions(&self) -> Ref<'_, Extensions>

Request extensions

Source

pub fn extensions_mut(&self) -> RefMut<'_, Extensions>

Mutable reference to a the request’s extensions

Trait Implementations§

Source§

impl Debug for Request

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Request

Source§

fn default() -> Request

Returns the “default value” for a type. Read more
Source§

impl HttpMessage for Request

Source§

fn message_extensions(&self) -> Ref<'_, Extensions>

Request extensions

Source§

fn message_extensions_mut(&self) -> RefMut<'_, Extensions>

Mutable reference to a the request’s extensions

Source§

fn message_headers(&self) -> &HeaderMap

Read the message headers.
Source§

fn content_type(&self) -> &str

Read the request content type. If request does not contain Content-Type header, empty str get returned.
Source§

fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>

Get content type encoding Read more
Source§

fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>

Convert the request content type to a known mime type.
Source§

fn chunked(&self) -> Result<bool, DecodeError>

Check if request has chunked transfer encoding
Source§

fn cookies(&self) -> Result<Ref<'_, Vec<Cookie<'static>>>, ParseError>

Load request cookies.
Source§

fn cookie(&self, name: &str) -> Option<Cookie<'static>>

Return request cookie.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.