#[non_exhaustive]pub struct APIRequestOptions {
pub headers: Option<HashMap<String, String>>,
pub params: Option<Vec<(String, String)>>,
pub data: Option<Value>,
pub form: Option<HashMap<String, String>>,
pub timeout: Option<f64>,
}Expand description
Options for crate::APIRequestContext requests.
Mirrors the relevant subset of Playwright’s API request options. data
(JSON body) and form (URL-encoded form) are mutually exclusive; if both
are set, data wins.
See: https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.headers: Option<HashMap<String, String>>Per-request headers (merged on top of the context’s default headers).
params: Option<Vec<(String, String)>>URL query parameters.
data: Option<Value>JSON request body. Sent as application/json.
form: Option<HashMap<String, String>>URL-encoded form body. Sent as application/x-www-form-urlencoded.
timeout: Option<f64>Per-request timeout, in milliseconds.
Implementations§
Source§impl APIRequestOptions
impl APIRequestOptions
pub fn new() -> Self
Sourcepub fn headers(self, v: HashMap<String, String>) -> Self
pub fn headers(self, v: HashMap<String, String>) -> Self
Set the per-request headers (replaces any previously set headers).
Sourcepub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
Add a single header.
Sourcepub fn timeout_ms(self, v: f64) -> Self
pub fn timeout_ms(self, v: f64) -> Self
Set the per-request timeout in milliseconds.
Trait Implementations§
Source§impl Clone for APIRequestOptions
impl Clone for APIRequestOptions
Source§fn clone(&self) -> APIRequestOptions
fn clone(&self) -> APIRequestOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for APIRequestOptions
impl Debug for APIRequestOptions
Source§impl Default for APIRequestOptions
impl Default for APIRequestOptions
Source§fn default() -> APIRequestOptions
fn default() -> APIRequestOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for APIRequestOptions
impl RefUnwindSafe for APIRequestOptions
impl Send for APIRequestOptions
impl Sync for APIRequestOptions
impl Unpin for APIRequestOptions
impl UnsafeUnpin for APIRequestOptions
impl UnwindSafe for APIRequestOptions
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