Skip to main content

browser_commander/puppeteer/api/
http_response.rs

1// @generated by scripts/generate-puppeteer-bindings.mjs from
2// rust/protocol/puppeteer/api.json. Do not edit by hand.
3
4#![allow(clippy::all, missing_docs, unused_imports, non_snake_case)]
5
6use serde_json::Value;
7
8use super::*;
9use crate::puppeteer::bridge::{binary, remote_type, BridgeError, JsFunction, Remote};
10
11remote_type!(
12    /// Puppeteer's `HTTPResponse` (puppeteer-core 25.12.0), a remote object
13    /// served by `browser-commander serve --stdio`.
14    HTTPResponse
15);
16
17impl HTTPResponse {
18    /// `HTTPResponse.remoteAddress`
19    ///
20    /// ```text
21    /// remoteAddress(): RemoteAddress
22    /// ```
23    pub async fn remote_address(&self) -> Result<Value, BridgeError> {
24        self.remote.call("remoteAddress", vec![]).await
25    }
26
27    /// `HTTPResponse.url`
28    ///
29    /// ```text
30    /// url(): string
31    /// ```
32    pub async fn url(&self) -> Result<String, BridgeError> {
33        self.remote.call("url", vec![]).await
34    }
35
36    /// `HTTPResponse.ok`
37    ///
38    /// ```text
39    /// ok(): boolean
40    /// ```
41    pub async fn ok(&self) -> Result<bool, BridgeError> {
42        self.remote.call("ok", vec![]).await
43    }
44
45    /// `HTTPResponse.status`
46    ///
47    /// ```text
48    /// status(): number
49    /// ```
50    pub async fn status(&self) -> Result<f64, BridgeError> {
51        self.remote.call("status", vec![]).await
52    }
53
54    /// `HTTPResponse.statusText`
55    ///
56    /// ```text
57    /// statusText(): string
58    /// ```
59    pub async fn status_text(&self) -> Result<String, BridgeError> {
60        self.remote.call("statusText", vec![]).await
61    }
62
63    /// `HTTPResponse.headers`
64    ///
65    /// ```text
66    /// headers(): Record<string, string>
67    /// ```
68    pub async fn headers(&self) -> Result<Value, BridgeError> {
69        self.remote.call("headers", vec![]).await
70    }
71
72    /// `HTTPResponse.securityDetails`
73    ///
74    /// ```text
75    /// securityDetails(): SecurityDetails | null
76    /// ```
77    pub async fn security_details(&self) -> Result<Option<SecurityDetails>, BridgeError> {
78        self.remote.call("securityDetails", vec![]).await
79    }
80
81    /// `HTTPResponse.timing`
82    ///
83    /// ```text
84    /// timing(): Protocol.Network.ResourceTiming | null
85    /// ```
86    pub async fn timing(&self) -> Result<Option<Value>, BridgeError> {
87        self.remote.call("timing", vec![]).await
88    }
89
90    /// `HTTPResponse.content`
91    ///
92    /// ```text
93    /// content(): Promise<Uint8Array>
94    /// ```
95    pub async fn content(&self) -> Result<Vec<u8>, BridgeError> {
96        self.remote.call("content", vec![]).await
97    }
98
99    /// `HTTPResponse.buffer`
100    ///
101    /// ```text
102    /// buffer(): Promise<Buffer>
103    /// ```
104    pub async fn buffer(&self) -> Result<Vec<u8>, BridgeError> {
105        self.remote.call("buffer", vec![]).await
106    }
107
108    /// `HTTPResponse.text`
109    ///
110    /// ```text
111    /// text(): Promise<string>
112    /// ```
113    pub async fn text(&self) -> Result<String, BridgeError> {
114        self.remote.call("text", vec![]).await
115    }
116
117    /// `HTTPResponse.json`
118    ///
119    /// ```text
120    /// json(): Promise<any>
121    /// ```
122    pub async fn json(&self) -> Result<Value, BridgeError> {
123        self.remote.call("json", vec![]).await
124    }
125
126    /// `HTTPResponse.request`
127    ///
128    /// ```text
129    /// request(): HTTPRequest
130    /// ```
131    pub async fn request(&self) -> Result<HTTPRequest, BridgeError> {
132        self.remote.call("request", vec![]).await
133    }
134
135    /// `HTTPResponse.fromCache`
136    ///
137    /// ```text
138    /// fromCache(): boolean
139    /// ```
140    pub async fn from_cache(&self) -> Result<bool, BridgeError> {
141        self.remote.call("fromCache", vec![]).await
142    }
143
144    /// `HTTPResponse.fromServiceWorker`
145    ///
146    /// ```text
147    /// fromServiceWorker(): boolean
148    /// ```
149    pub async fn from_service_worker(&self) -> Result<bool, BridgeError> {
150        self.remote.call("fromServiceWorker", vec![]).await
151    }
152
153    /// `HTTPResponse.frame`
154    ///
155    /// ```text
156    /// frame(): Frame | null
157    /// ```
158    pub async fn frame(&self) -> Result<Option<Frame>, BridgeError> {
159        self.remote.call("frame", vec![]).await
160    }
161}