Struct worker::RequestInit
source · [−]pub struct RequestInit {
pub body: Option<JsValue>,
pub headers: Headers,
pub cf: CfProperties,
pub method: Method,
pub redirect: RequestRedirect,
}
Expand description
Optional options struct that contains settings to apply to the Request
.
Fields
body: Option<JsValue>
Currently requires a manual conversion from your data into a wasm_bindgen::JsValue
.
headers: Headers
Headers associated with the outbound Request
.
cf: CfProperties
Cloudflare-specific properties that can be set on the Request
that control how Cloudflare’s
edge handles the request.
method: Method
The HTTP Method used for this Request
.
redirect: RequestRedirect
The redirect mode to use: follow, error, or manual. The default for a new Request object is follow. Note, however, that the incoming Request property of a FetchEvent will have redirect mode manual.
Implementations
sourceimpl RequestInit
impl RequestInit
pub fn new() -> Self
pub fn with_headers(&mut self, headers: Headers) -> &mut Self
pub fn with_method(&mut self, method: Method) -> &mut Self
pub fn with_redirect(&mut self, redirect: RequestRedirect) -> &mut Self
pub fn with_body(&mut self, body: Option<JsValue>) -> &mut Self
pub fn with_cf_properties(&mut self, props: CfProperties) -> &mut Self
Trait Implementations
sourceimpl Default for RequestInit
impl Default for RequestInit
sourceimpl From<&'_ RequestInit> for RequestInit
impl From<&'_ RequestInit> for RequestInit
sourcefn from(req: &RequestInit) -> Self
fn from(req: &RequestInit) -> Self
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for RequestInit
impl !Send for RequestInit
impl !Sync for RequestInit
impl Unpin for RequestInit
impl UnwindSafe for RequestInit
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more