Struct actix_web::HttpRequest[][src]

pub struct HttpRequest<S = ()> { /* fields omitted */ }

An HTTP Request

Methods

impl<S> HttpRequest<S>
[src]

Important traits for &'a mut R

Shared application state

Server request

Request extensions

Mutable reference to a the request's extensions

Create http response

Create http response builder

Read the Request Uri.

Read the Request method.

Read the Request Version.

The target path of this Request.

Get ConnectionInfo for the correct request.

Generate url for named resource

fn index(req: HttpRequest) -> HttpResponse {
    let url = req.url_for("foo", &["1", "2", "3"]); // <- generate url for "foo" resource
    HttpResponse::Ok().into()
}

fn main() {
    let app = App::new()
        .resource("/test/{one}/{two}/{three}", |r| {
             r.name("foo");  // <- set resource name, then it could be used in `url_for`
             r.method(http::Method::GET).f(|_| HttpResponse::Ok());
        })
        .finish();
}

Generate url for named resource

This method is similar to HttpRequest::url_for() but it can be used for urls that do not contain variable parts.

This method returns reference to current RouteInfo object.

Peer socket address

Peer address is actual socket address, if proxy is used in front of actix http server, then peer address would be address of this proxy.

To get client connection information connection_info() method should be used.

url query parameters.

The query string in the URL.

E.g., id=10

Load request cookies.

Return request cookie.

Get a reference to the Params object.

Params is a container for url parameters. A variable segment is specified in the form {identifier}, where the identifier can be used later in a request handler to access the matched value for that segment.

Set read buffer capacity

Default buffer capacity is 32Kb.

Methods from Deref<Target = Request>

Read the Request Uri.

Read the Request method.

Read the Request Version.

The target path of this Request.

Returns Request's headers.

Peer socket address

Peer address is actual socket address, if proxy is used in front of actix http server, then peer address would be address of this proxy.

To get client connection information connection_info() method should be used.

Checks if a connection should be kept alive.

Request extensions

Mutable reference to a the request's extensions

Check if request requires connection upgrade

Get ConnectionInfo for the correct request.

Server settings

Trait Implementations

impl<S> HttpMessage for HttpRequest<S>
[src]

Type of message payload stream

Read the message headers.

Message payload stream

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

Get content type encoding Read more

Convert the request content type to a known mime type.

Check if request has chunked transfer encoding

Load http message body. Read more

Parse application/x-www-form-urlencoded encoded request's body. Return UrlEncoded future. Form can be deserialized to any type that implements Deserialize trait from serde. Read more

Parse application/json encoded body. Return JsonBody<T> future. It resolves to a T value. Read more

Return stream to http payload processes as multipart. Read more

Return stream of lines.

impl<S> Deref for HttpRequest<S>
[src]

The resulting type after dereferencing.

Dereferences the value.

impl<S> Drop for HttpRequest<S>
[src]

Executes the destructor for this type. Read more

impl<S> Clone for HttpRequest<S>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<S> FromRequest<S> for HttpRequest<S>
[src]

Configuration for conversion process

Future that resolves to a Self

Convert request to a Self

Convert request to a Self Read more

impl<S> Debug for HttpRequest<S>
[src]

Formats the value using the given formatter. Read more

impl<'a, S> From<&'a HttpRequest<S>> for HttpResponseBuilder
[src]

Performs the conversion.

impl<'a, S: 'static> From<&'a HttpRequest<S>> for ClientRequestBuilder
[src]

Create ClientRequestBuilder from HttpRequest

It is useful for proxy requests. This implementation copies all request headers and the method.

Performs the conversion.

impl<S> RequestIdentity for HttpRequest<S>
[src]

Return the claimed identity of the user associated request or None if no identity can be found associated with the request. Read more

Remember identity.

This method is used to 'forget' the current identity on subsequent requests. Read more

impl<S> RequestSession for HttpRequest<S>
[src]

Get the session from the request

Auto Trait Implementations

impl<S = ()> !Send for HttpRequest<S>

impl<S = ()> !Sync for HttpRequest<S>