Skip to main content

Response

Struct Response 

Source
pub struct Response { /* private fields */ }

Implementations§

Source§

impl Response

Source

pub fn new(init: ResponseInit) -> Self

Source

pub fn url(&self) -> &str

Source

pub fn status(&self) -> i64

Source

pub fn status_text(&self) -> &str

Source

pub fn ok(&self) -> bool

Matches Playwright ok(): 0 || (200..=299).

Source

pub fn is_from_service_worker(&self) -> bool

Mirrors Playwright’s response.fromServiceWorker(): boolean. NAPI re-exports this as the Playwright-canonical method name.

Source

pub fn request(&self) -> Request

Source

pub fn frame_id(&self) -> Option<&str>

Source

pub fn headers(&self) -> Headers

Source

pub async fn all_headers(&self) -> Result<Headers>

All headers (raw if available, provisional otherwise).

§Errors

Returns an error if the raw-header fetcher fails.

Source

pub async fn headers_array(&self) -> Vec<HeaderEntry>

Source

pub async fn header_value(&self, name: &str) -> Result<Option<String>>

Single header value (case-insensitive). Per Playwright, multi-value headers are joined with , (or \n for Set-Cookie).

§Errors

Returns an error if the raw-header fetcher fails.

Source

pub async fn header_values(&self, name: &str) -> Result<Vec<String>>

All values for a given header name (case-insensitive, preserves duplicates).

§Errors

Returns an error if the raw-header fetcher fails.

Source

pub async fn finished(&self) -> Result<(), FerriError>

Wait for loadingFinished / loadingFailed. Resolves to Ok(()) on success or Err carrying the failure text.

Mirrors Playwright’s response.finished(): Promise<null | Error>. We expose Result rather than Option<Error> so the typed error flows through ? cleanly in Rust callers; the NAPI layer converts to Promise<null | Error> at the boundary.

§Errors

Returns the backend-reported failure text when the underlying load failed (e.g. loadingFailed.errorText on CDP).

Source

pub async fn body(&self) -> Result<Vec<u8>>

Response body bytes. Cached after first call.

§Errors

Returns an error if the body fetcher fails or the backend doesn’t support body retrieval (typed FerriError::Unsupported).

Source

pub async fn text(&self) -> Result<String>

Body decoded as UTF-8 text.

§Errors

Returns an error if the body fetch fails or the bytes are not UTF-8.

Source

pub async fn json(&self) -> Result<Value>

Body parsed as JSON.

§Errors

Returns an error if the body fetch fails or JSON parse fails.

Source

pub async fn server_addr(&self) -> Option<RemoteAddr>

Source

pub async fn security_details(&self) -> Option<SecurityDetails>

Source

pub async fn http_version(&self) -> Option<String>

HTTP protocol version (e.g. http/1.1), or None when the backend did not report one. Playwright: response.httpVersion(): Promise<string> (client/network.ts) — async to mirror the channel round-trip Playwright performs.

Source

pub async fn set_raw_headers(&self, raw: Vec<HeaderEntry>)

Source

pub async fn finish_success(&self)

Source

pub async fn finish_failure(&self, error: impl Into<FerriError>)

Trait Implementations§

Source§

impl Clone for Response

Source§

fn clone(&self) -> Response

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Response

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,