pub struct FetchResponse {
pub status: u16,
pub status_text: String,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
}Expand description
Response from route.fetch(), allowing inspection and modification before fulfillment.
Fields§
§status: u16HTTP status code
status_text: StringHTTP status text
headers: Vec<(String, String)>Response headers as name-value pairs
body: Vec<u8>Response body as bytes
Implementations§
Source§impl FetchResponse
impl FetchResponse
Sourcepub fn status_text(&self) -> &str
pub fn status_text(&self) -> &str
Returns the status text
Sourcepub fn json<T: DeserializeOwned>(&self) -> Result<T>
pub fn json<T: DeserializeOwned>(&self) -> Result<T>
Returns the response body parsed as JSON
Trait Implementations§
Source§impl Clone for FetchResponse
impl Clone for FetchResponse
Source§fn clone(&self) -> FetchResponse
fn clone(&self) -> FetchResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FetchResponse
impl RefUnwindSafe for FetchResponse
impl Send for FetchResponse
impl Sync for FetchResponse
impl Unpin for FetchResponse
impl UnsafeUnpin for FetchResponse
impl UnwindSafe for FetchResponse
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