Skip to main content

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:​

MethodReturn TypeDescription
body&BodyReturns a reference to the associated HTTP body.
body_mut&mut BodyReturns a mutable reference to the associated HTTP body.
extensions&ExtensionsReturns a reference to the associated extensions.
extensions_mut&mut ExtensionsReturns a mutable reference to the associated extensions.
headers&HeaderMapReturns a reference to the associated header field map.
headers_mut&mut HeaderMapReturns a mutable reference to the associated header field map.
into_bodyBodyConsumes the request, returning just the body.
into_parts(Parts, Body)Consumes the request returning the head and body parts.
mapRequest<U>Consumes the request returning a new request with body mapped to the return type of the passed in function.
method&MethodReturns a reference to the associated HTTP method.
method_mut&mut MethodReturns a mutable reference to the associated HTTP method.
uri&UriReturns a reference to the associated URI.
uri_mut&mut UriReturns a mutable reference to the associated URI.
versionVersionReturns the associated HTTP version.
version_mut&mut VersionReturns a mutable reference to the associated HTTP version.