network.responseStarted event
The network.responseStarted event of the network module fires when the browser has received the headers of a response, before it has received the whole response body.
Event data
The params field in the event notification is an object with the following fields:
context-
A string that contains the ID of the context in which the request was made, or
nullif the request wasn't made by a document in a context, for example a request made by a worker. interceptsOptional-
An array of one or more strings, each containing the ID of an intercept that blocks the response. This field is included only when
isBlockedistrue. Intercept IDs are returned by thenetwork.addInterceptcommand. isBlocked-
A boolean that indicates whether the response is blocked by an intercept.
true: The response matches one or more intercepts listed in theinterceptsfield and is blocked. The browser doesn't process the response further until the client resumes it, for example with thenetwork.continueResponsecommand.false: The response doesn't match any of the session's intercepts, so the client doesn't need to resume it.
-
A string that contains the UUID that uniquely identifies the navigation that the request is part of, or
nullif the request isn't a navigation request. For example, the value isnullwhen requesting a document's subresources, such as stylesheets and scripts, or when making a request withfetch(). If the navigation was started using thebrowsingContext.navigateorbrowsingContext.reloadcommand, this ID matches thenavigationvalue in the command's response. Other events related to this navigation share the same navigation ID, including events in thebrowsingContextandnetworkmodules. redirectCount-
A non-negative integer that contains the number of redirects the browser has followed for this request. It is
0for the original request and increases by one with each redirect. request-
An object that describes the request. It contains the following fields:
bodySize-
A non-negative integer that contains the size of the request body in bytes, or
nullif the request has no body. -
An array of objects, each representing a cookie sent with the request. The array is empty if the request has no
Cookieheader. Each object contains the following fields and may additionally include browser-specific fields:domain-
A string that contains the domain of the cookie.
expiryOptional-
A non-negative integer that contains the expiry time of the cookie, as seconds elapsed since the epoch. This field is omitted for a cookie that has no expiry time, such as a session cookie.
httpOnly-
A boolean that indicates whether the cookie is hidden from page scripts by its
HttpOnlyattribute (true) or is accessible to them (false). name-
A string that contains the name of the cookie.
path-
A string that contains the path of the cookie.
sameSite-
A string that indicates the cookie's
SameSitesetting. It has one of the following values:default: The cookie has noSameSiteattribute or has an unrecognized value, so the browser's default behavior applies.lax: The cookie hasSameSite=Lax.none: The cookie hasSameSite=None.strict: The cookie hasSameSite=Strict.
secure-
A boolean that indicates whether the cookie is restricted to secure connections by its
Secureattribute (true) or can be sent over insecure connections (false). size-
A non-negative integer that contains the combined size of the cookie's name and value, in bytes.
value-
An object that contains the value of the cookie. It contains the following fields:
destination-
A string that contains the destination of the request, such as
document,script, orstyle. The string is empty for requests made withfetch()orXMLHttpRequest. headers-
An array of objects, each representing a header of the request, including headers added with the
network.setExtraHeaderscommand. Each object contains the following fields:name-
A string that contains the header name, such as
Accept. value-
An object that contains the header value. It contains the following fields:
headersSize-
A non-negative integer that contains the size of the request headers in bytes. For protocols that compress headers, such as HTTP/2, it represents the compressed size.
initiatorType-
A string that indicates what started the request, such as
fetch,link, orscript. For a request with no initiator type, such as the request for a page loaded into a tab, the value isnullinstead of a string. SeePerformanceResourceTiming.initiatorTypefor descriptions of common values. method-
A string that contains the HTTP request method, such as
GETorPOST. request-
A string that contains the ID of the request. The ID stays the same even when the request is redirected.
timings-
An object that contains the times at which the stages of the request happened. The
timeOriginfield contains a time in milliseconds since the epoch. The other fields in this object contain times in milliseconds relative totimeOrigin. A field is0if its stage hasn't happened, for example the redirect fields for a request that wasn't redirected. All the fields are0if the request wasn't made by a document or a worker. It contains the following fields:connectEnd-
A number that represents the time when the browser finished establishing the connection to the server, similar to
PerformanceResourceTiming.connectEnd. connectStart-
A number that represents the time when the browser started establishing the connection to the server, similar to
PerformanceResourceTiming.connectStart. dnsEnd-
A number that represents the time when the browser finished the domain name lookup, similar to
PerformanceResourceTiming.domainLookupEnd. dnsStart-
A number that represents the time when the browser started the domain name lookup, similar to
PerformanceResourceTiming.domainLookupStart. fetchStart-
A number that represents the time when the browser started fetching the resource after any redirects, similar to
PerformanceResourceTiming.fetchStart. redirectEnd-
A number that represents the time when the browser received the last byte of the response to the last redirect, similar to
PerformanceResourceTiming.redirectEnd. redirectStart-
A number that represents the time when the request that was redirected first started, similar to
PerformanceResourceTiming.redirectStart. requestStart-
A number that represents the time when the browser started sending the request, similar to
PerformanceResourceTiming.requestStart. requestTime-
A number that represents the time when the request started, similar to
PerformanceEntry.startTime. responseEnd-
A number that represents the time when the browser received the last byte of the response, similar to
PerformanceResourceTiming.responseEnd. responseStart-
A number that represents the time when the browser received the first byte of the response, similar to
PerformanceResourceTiming.responseStart. timeOrigin-
A number that represents the time origin of the document or worker that made the request.
tlsStart-
A number that represents the time when the browser started the TLS handshake to secure the connection, similar to
PerformanceResourceTiming.secureConnectionStart.
url-
A string that contains the URL of the request.
response-
An object that describes the response. It contains the following fields:
authChallengesOptional-
An array of objects, each representing an authentication challenge from the server. This field is included only when the response status is
401or407. The challenges come from theWWW-Authenticateheader for401responses or theProxy-Authenticateheader for407responses. The array is empty if the response doesn't include the corresponding header. Each object contains the following fields:realm-
A string that contains the realm of the challenge, or an empty string if the challenge has no realm.
scheme-
A string that contains the authentication scheme, such as
Basic.
bodySize-
A non-negative integer that contains the size of the response body, in bytes, before the browser decodes it (for example, before decompression), or
nullif the browser doesn't report it. The body might not have arrived yet when this event fires, so the final size is available in thenetwork.responseCompletedevent. bytesReceived-
A non-negative integer that contains the total number of bytes received for the response, including its headers. It is
0for a response served from the browser's cache. content-
An object that describes the decoded response body. It contains the following field:
size-
A non-negative integer that contains the size of the response body in bytes after the browser decodes it (for example, after decompression).
fromCache-
A boolean that indicates whether the browser served the response from its cache.
true: The browser served the response from its cache without contacting the server.false: The browser didn't serve the response from its cache. This includes cases where it contacted the server to revalidate a cached response.
headers-
An array of objects, each representing a header of the response. Each object contains the following fields:
name-
A string that contains the header name, such as
Content-Type. value-
An object that contains the header value. It contains the following fields:
headersSize-
A non-negative integer that contains the size of the response headers, in bytes, as received, or
nullif the browser doesn't report it. mimeType-
A string that contains the MIME type that the browser uses for the response, such as
text/htmlorapplication/json. The value doesn't include MIME type parameters. It can differ from theContent-Typeheader, for example when the browser determines the type from the content. It can also be an empty string, for example for a redirect response. protocol-
A string that contains the protocol of the response, such as
http/1.1orh2. For a response that wasn't received over HTTP, it is the scheme of the response URL, such asdata. status-
A non-negative integer that contains the HTTP status code of the response, such as
200. statusText-
A string that contains the status message of the response, such as
OK. url-
A string that contains the URL of the response.
timestamp-
A non-negative integer that represents the time when the event was fired, as milliseconds elapsed since the epoch.
userContextOptional-
A string that contains the ID of the user context in which the request was made, or
nullif the request wasn't made by a document in a context.
Description
In the lifecycle of a request, this event fires after network.beforeRequestSent and before network.responseCompleted, which fires when the browser has received the whole response body.
It also fires for redirect responses and for responses served from the browser's cache.
If the request fails after this event, for example because the page aborts it, the network.fetchError event fires.
For a response that asks for authentication, the network.authRequired event can follow.
At this point, the response object contains the status and the headers, but the fields that describe the body, such as bodySize, bytesReceived, and content, might not have their final values yet.
When isBlocked is true, the response waits until the client resumes it with the network.continueResponse, network.failRequest, or network.provideResponse command.
Depending on the phases configured for each intercept, the browser can block a response when network.responseStarted fires regardless of whether it blocked the request when network.beforeRequestSent fired.
It can also block the request when network.beforeRequestSent fires without blocking the response when network.responseStarted fires.
Examples
>Receiving an event when response headers arrive
Assume you have a WebDriver BiDi connection, an active session, and a subscription to network.responseStarted.
Suppose a tab has loaded https://example.com/.
The browser has a theme=dark cookie for the site.
The page calls fetch("/api/items") to load a list of items as JSON.
When the response headers arrive, the browser sends the following event (for brevity, the headers array in the request object has been shortened and some of its fields have been omitted):
{
"type": "event",
"method": "network.responseStarted",
"params": {
"context": "93ee5bd6-d256-4608-a002-9a8995cc0e5f",
"isBlocked": false,
"navigation": null,
"redirectCount": 0,
"request": {
"cookies": [
{
"domain": "example.com",
"httpOnly": false,
"name": "theme",
"path": "/",
"sameSite": "lax",
"secure": false,
"size": 9,
"value": {
"type": "string",
"value": "dark"
}
}
],
"destination": "",
"headers": [
{
"name": "Host",
"value": {
"type": "string",
"value": "example.com"
}
},
{
"name": "Accept",
"value": {
"type": "string",
"value": "*/*"
}
}
],
"headersSize": 401,
"initiatorType": "fetch",
"method": "GET",
"request": "b9e201af-6475-4bea-a174-51a8290f8087",
"url": "https://example.com/api/items"
},
"response": {
"bodySize": 0,
"bytesReceived": 188,
"content": {
"size": 0
},
"fromCache": false,
"headers": [
{
"name": "Cache-Control",
"value": {
"type": "string",
"value": "no-store"
}
},
{
"name": "Content-Type",
"value": {
"type": "string",
"value": "application/json"
}
},
{
"name": "Date",
"value": {
"type": "string",
"value": "Tue, 13 Oct 2026 14:58:02 GMT"
}
},
{
"name": "Connection",
"value": {
"type": "string",
"value": "keep-alive"
}
},
{
"name": "Keep-Alive",
"value": {
"type": "string",
"value": "timeout=5"
}
},
{
"name": "Transfer-Encoding",
"value": {
"type": "string",
"value": "chunked"
}
}
],
"headersSize": 188,
"mimeType": "application/json",
"protocol": "http/1.1",
"status": 200,
"statusText": "OK",
"url": "https://example.com/api/items"
},
"timestamp": 1791903482441,
"userContext": "default"
}
}
At this point, the browser has received the response headers but not necessarily the body.
The final bytesReceived and body sizes are in the response object of the network.responseCompleted event with the same request ID.
Receiving an event for a response from the cache
Using the same connection, session, and subscription as in the first example, suppose the page fetches the same URL twice.
The server allows the browser to cache the response for an hour (Cache-Control: max-age=3600).
For the second request, the browser serves the response from its cache and sends the following event (only some of the fields are shown):
{
"type": "event",
"method": "network.responseStarted",
"params": {
"context": "93ee5bd6-d256-4608-a002-9a8995cc0e5f",
"isBlocked": false,
"navigation": null,
"redirectCount": 0,
"request": {
"request": "37cf22b4-f399-4450-828d-d54fce56004e",
"url": "https://example.com/api/categories"
},
"response": {
"bytesReceived": 0,
"fromCache": true,
"status": 200,
"url": "https://example.com/api/categories"
},
"timestamp": 1791903483454
}
}
In the response object, fromCache is true and bytesReceived is 0 because nothing was received from the server.
Specifications
| Specification |
|---|
| WebDriver BiDi> # event-network-responseStarted> |
Browser compatibility
See also
network.beforeRequestSenteventnetwork.responseCompletedeventnetwork.fetchErroreventnetwork.authRequiredeventsession.subscribecommand- HTTP response status codes reference