Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions docs/src/api/class-apirequestcontext.md
Original file line number Diff line number Diff line change
Expand Up @@ -897,3 +897,72 @@ Returns storage state for this request context, contains current cookies and loc
- `indexedDB` ?<boolean>

Set to `true` to include IndexedDB in the storage state snapshot.


## event: APIRequestContext.apiRequest
* since: v1.51
- argument: <[Object]>
- `guid` <[string]> request GUID
- `url` <[URL]> request URL
- `method` <[string]> request method
- `headers` <[Object]<[string], [string]>> request headers
- `cookies` <[Array]<[Object]>>
- `name` <[string]>
- `value` <[string]>
- `postData` ?<[Buffer]> request post data

Emitted when a request is issued from any requests created through this context.
The [APIRequestEvent] object is read-only.

## event: APIRequestContext.apiRequestFinished
* since: v1.51
- argument: <[Object]>
- `httpVersion` <[string]> HTTP version
- `rawHeaders` <[Array]<[string]>> raw headers
- `statusCode` <[int]> status code
- `statusMessage` <[string]> status message
- `body` ?<[Buffer]> response body
- `headers` <[IncomingHttpHeaders]>> response headers
- `serverIPAddress` ?<[string]> server IP address
- `serverPort` ?<[int]> server port
- `timings` <[Object]>
- `blocked` ?<[int]>
- `dns` ?<[int]>
- `connect` ?<[int]>
- `send` <[int]>
- `wait` <[int]>
- `receive` <[int]>
- `ssl` ?<[int]>
- `comment` ?<[string]>
- `cookies` <[Array]<[Object]>>
- `name` <[string]>
- `value` <[string]>
- `domain` <[string]>
- `path` <[string]>
- `expires` <[float]> Unix time in seconds.
- `httpOnly` <[boolean]>
- `secure` <[boolean]>
- `sameSite` <[SameSiteAttribute]<"Strict"|"Lax"|"None">>
- `securityDetails` ?<[Object]> security details
- `issuer` ?<[string]> Common Name component of the Issuer field.
from the certificate. This should only be used for informational purposes. Optional.
- `protocol` ?<[string]> The specific TLS protocol used. (e.g. `TLS 1.3`). Optional.
- `subjectName` ?<[string]> Common Name component of the Subject
field from the certificate. This should only be used for informational purposes. Optional.
- `validFrom` ?<[float]> Unix timestamp (in seconds) specifying
when this cert becomes valid. Optional.
- `validTo` ?<[float]> Unix timestamp (in seconds) specifying
when this cert becomes invalid. Optional.
- `requestEvent` <[Object]> request event object
- `guid` <[string]> request GUID
- `url` <[URL]> request URL
- `method` <[string]> request method
- `headers` <[Object]<[string], [string]>> request headers
- `cookies` <[Array]<[Object]>>
- `name` <[string]>
- `value` <[string]>
- `postData` ?<[Buffer]> request post data


Emitted when a request finishes in any requests created through this context. The
sequence of events is `apirequest` and `apirequestfinished`
3 changes: 3 additions & 0 deletions docs/src/service-workers-experimental-network-events-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ Additionally, any network request made by the **Page** (including its sub-[Frame
* [`method: Request.serviceWorker`] will be set to `null`, and [`method: Request.frame`] will return the [Frame]
* [`method: Response.fromServiceWorker`] will return `true` (if a Service Worker's fetch handler was registered)

Any requests made by **APIRequestContext** will have
* [`event: APIRequestContext.apiRequest`] and its corresponding event ([`event: APIRequestContext.apiRequestFinished`])

Many Service Worker implementations simply execute the request from the page (possibly with some custom caching/offline logic omitted for simplicity):

```js title="transparent-service-worker.js"
Expand Down
Loading