Puppeteer 響應(yīng)

2020-06-29 14:19 更新

class:response

class: Response v0.9.0

Response 類表示頁(yè)面接收的響應(yīng)。

Methods

  • response.buffer()v0.9.0
  • response.frame()v0.9.0
  • response.fromCache()v0.9.0
  • response.fromServiceWorker()v0.9.0
  • response.headers()v0.9.0
  • response.json()v0.9.0
  • response.ok()v0.9.0
  • response.remoteAddress()v0.9.0
  • response.request()v0.9.0
  • response.securityDetails()v0.9.0
  • response.status()v0.9.0
  • response.statusText()v0.9.0
  • response.text()v0.9.0
  • response.url()v0.9.0

Methods

response.buffer()v0.9.0

returns: > Promise which resolves to a buffer with response body.

response.frame()v0.9.0

returns: <?Frame> 響應(yīng)請(qǐng)求的 Frame,如果導(dǎo)航到錯(cuò)誤頁(yè)面,則為null。

response.fromCache()v0.9.0

returns: <boolean> 如果響應(yīng)來(lái)自瀏覽器的磁盤緩存或內(nèi)存緩存,則為 true。

response.fromServiceWorker()v0.9.0

returns: <boolean> 如果響應(yīng)是由 service worker 提供的,則為 true。

response.headers()v0.9.0

returns: <Object> 具有與響應(yīng)關(guān)聯(lián)的 HTTP 頭對(duì)象。 所有標(biāo)題名稱都是小寫。

response.json()v0.9.0

returns: > Promise which resolves to a JSON representation of response body. 如果響應(yīng)主體無(wú)法進(jìn)行 JSON.parse 解析,則此方法將拋出錯(cuò)誤。

response.ok()v0.9.0

returns: <boolean> 包含一個(gè)布爾值,說(shuō)明響應(yīng)是否成功(狀態(tài)范圍為200-299)。

response.remoteAddress()v0.9.0

returns: <Object> ip <string> 遠(yuǎn)程服務(wù)的 IP 地址 port <number> 連接遠(yuǎn)程服務(wù)的端口號(hào)

response.request()v0.9.0

returns: <Request> 一個(gè)匹配的 Request 對(duì)象.

response.securityDetails()v0.9.0

returns: <?SecurityDetails> 如果通過(guò)安全連接接收到響應(yīng),則為安全細(xì)節(jié),否則為null。

response.status()v0.9.0

returns: <number> 包含響應(yīng)的狀態(tài)代碼(例如,200成功)。

response.statusText()v0.9.0

returns: <string> 包含響應(yīng)的狀態(tài)文本(例如,通常成功的 "OK")。

response.text()v0.9.0

returns: <Promise<string>> Promise which resolves to a text representation of response body.

response.url()v0.9.0

returns: <string> 包含響應(yīng)的 URL。

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)