pub struct Request { /* private fields */ }
Expand description
Incoming HTTP request (to Worker).
Implementations§
Source§impl Request
impl Request
Sourcepub fn new(
method: Method,
url: Url,
headers: Headers,
body: Option<Vec<u8>>,
) -> Request
pub fn new( method: Method, url: Url, headers: Headers, body: Option<Vec<u8>>, ) -> Request
Creates Request object representing incoming HTTP request
Sourcepub fn get_header(&self, name: &str) -> Option<String>
pub fn get_header(&self, name: &str) -> Option<String>
Returns the value of the header, or None if the header is not set. Header name search is case-insensitive.
Sourcepub fn has_header(&self, name: &str) -> bool
pub fn has_header(&self, name: &str) -> bool
Returns true if the header is set. Name is case-insensitive.
Sourcepub fn body(&self) -> Option<&Vec<u8>>
pub fn body(&self) -> Option<&Vec<u8>>
Returns request body as byte vector, or None if body is empty
Sourcepub fn json<T: DeserializeOwned>(&self) -> Result<T, Error>
pub fn json<T: DeserializeOwned>(&self) -> Result<T, Error>
Interpret body as json object.
Returns the cookie string, if set
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl !Send for Request
impl Unpin for Request
impl UnwindSafe for Request
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more