Struct ntex::web::HttpRequest [−][src]
pub struct HttpRequest(_);
Expand description
An HTTP Request
Implementations
This method returns reference to the request head
The query string in the URL.
E.g., id=10
Get a reference to the Path parameters.
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.
Request extensions
Mutable reference to a the request’s extensions
Get a reference to a ResourceMap
of current application.
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.
To get client connection information .connection_info()
should be used.
Get ConnectionInfo for the current request.
This method panics if request’s extensions container is already borrowed.
App config
Trait Implementations
It is possible to get HttpRequest
as an extractor handler parameter
Example
use ntex::web::{self, App, HttpRequest};
/// extract `HttpRequest` from request
async fn index(req: HttpRequest) -> String {
format!("Got thing: {:?}", req)
}
fn main() {
let app = App::new().service(
web::resource("/users/{first}").route(
web::get().to(index))
);
}
Convert request to a Self
Convert request to a Self Read more
Returns Request’s headers.
Request extensions
Mutable reference to a the request’s extensions
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 request cookies.
Return request cookie.
Auto Trait Implementations
impl !RefUnwindSafe for HttpRequest
impl !Send for HttpRequest
impl !Sync for HttpRequest
impl Unpin for HttpRequest
impl !UnwindSafe for HttpRequest
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more