pub struct Response { /* private fields */ }Implementations§
Source§impl Response
impl Response
pub fn new(init: ResponseInit) -> Self
pub fn url(&self) -> &str
pub fn status(&self) -> i64
pub fn status_text(&self) -> &str
Sourcepub fn is_from_service_worker(&self) -> bool
pub fn is_from_service_worker(&self) -> bool
Mirrors Playwright’s response.fromServiceWorker(): boolean. NAPI
re-exports this as the Playwright-canonical method name.
pub fn request(&self) -> Request
pub fn frame_id(&self) -> Option<&str>
pub fn headers(&self) -> Headers
Sourcepub async fn all_headers(&self) -> Result<Headers>
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.
pub async fn headers_array(&self) -> Vec<HeaderEntry>
Sourcepub async fn header_value(&self, name: &str) -> Result<Option<String>>
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.
Sourcepub async fn header_values(&self, name: &str) -> Result<Vec<String>>
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.
Sourcepub async fn finished(&self) -> Result<(), FerriError>
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).
Sourcepub async fn body(&self) -> Result<Vec<u8>>
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).
Sourcepub async fn text(&self) -> Result<String>
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.
pub async fn server_addr(&self) -> Option<RemoteAddr>
pub async fn security_details(&self) -> Option<SecurityDetails>
Sourcepub async fn http_version(&self) -> Option<String>
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.