pub struct APIRequestContext { /* private fields */ }Expand description
A standalone HTTP client. Cheap to clone — it shares one underlying
reqwest::Client and a set of default headers.
Mirrors https://playwright.dev/docs/api/class-apirequestcontext.
Implementations§
Source§impl APIRequestContext
impl APIRequestContext
Sourcepub fn new(default_headers: Headers) -> Self
pub fn new(default_headers: Headers) -> Self
Create a new context with the given default headers (cloned into the
context). A fresh reqwest::Client is built once and reused.
Sourcepub fn default_headers(&self) -> &Headers
pub fn default_headers(&self) -> &Headers
The default headers carried by this context.
Sourcepub async fn get(
&self,
url: &str,
options: Option<APIRequestOptions>,
) -> Result<APIResponse>
pub async fn get( &self, url: &str, options: Option<APIRequestOptions>, ) -> Result<APIResponse>
GET.
Sourcepub async fn post(
&self,
url: &str,
options: Option<APIRequestOptions>,
) -> Result<APIResponse>
pub async fn post( &self, url: &str, options: Option<APIRequestOptions>, ) -> Result<APIResponse>
POST.
Sourcepub async fn put(
&self,
url: &str,
options: Option<APIRequestOptions>,
) -> Result<APIResponse>
pub async fn put( &self, url: &str, options: Option<APIRequestOptions>, ) -> Result<APIResponse>
PUT.
Sourcepub async fn patch(
&self,
url: &str,
options: Option<APIRequestOptions>,
) -> Result<APIResponse>
pub async fn patch( &self, url: &str, options: Option<APIRequestOptions>, ) -> Result<APIResponse>
PATCH.
Sourcepub async fn delete(
&self,
url: &str,
options: Option<APIRequestOptions>,
) -> Result<APIResponse>
pub async fn delete( &self, url: &str, options: Option<APIRequestOptions>, ) -> Result<APIResponse>
DELETE.
Sourcepub async fn head(
&self,
url: &str,
options: Option<APIRequestOptions>,
) -> Result<APIResponse>
pub async fn head( &self, url: &str, options: Option<APIRequestOptions>, ) -> Result<APIResponse>
HEAD.
Trait Implementations§
Source§impl Clone for APIRequestContext
impl Clone for APIRequestContext
Source§fn clone(&self) -> APIRequestContext
fn clone(&self) -> APIRequestContext
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for APIRequestContext
impl !UnwindSafe for APIRequestContext
impl Freeze for APIRequestContext
impl Send for APIRequestContext
impl Sync for APIRequestContext
impl Unpin for APIRequestContext
impl UnsafeUnpin for APIRequestContext
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