Request
What's a request?​
An HTTP request consists of a head and a potentially optional body.
The body component is generic, enabling arbitrary types to represent the HTTP body.
About the Graphul implementation​
In Graphul the Req contains a Generic Data Type, for example, the body could be Vec<u8>, a Stream of byte chunks, or a value that has been deserialized.
This struct is accessible in a middleware handler, Graphul reuses the Request struct of Axum
This struct implements the following methods:​
| Method | Return Type | Description |
|---|---|---|
| body | &Body | Returns a reference to the associated HTTP body. |
| body_mut | &mut Body | Returns a mutable reference to the associated HTTP body. |
| extensions | &Extensions | Returns a reference to the associated extensions. |
| extensions_mut | &mut Extensions | Returns a mutable reference to the associated extensions. |
| headers | &HeaderMap | Returns a reference to the associated header field map. |
| headers_mut | &mut HeaderMap | Returns a mutable reference to the associated header field map. |
| into_body | Body | Consumes the request, returning just the body. |
| into_parts | (Parts, Body) | Consumes the request returning the head and body parts. |
| map | Request<U> | Consumes the request returning a new request with body mapped to the return type of the passed in function. |
| method | &Method | Returns a reference to the associated HTTP method. |
| method_mut | &mut Method | Returns a mutable reference to the associated HTTP method. |
| uri | &Uri | Returns a reference to the associated URI. |
| uri_mut | &mut Uri | Returns a mutable reference to the associated URI. |
| version | Version | Returns the associated HTTP version. |
| version_mut | &mut Version | Returns a mutable reference to the associated HTTP version. |