Skip to content

Commit 1ea00c4

Browse files
committed
Add a command to get response body
1 parent e25f510 commit 1ea00c4

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

index.bs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/
9393
text: no such alert; url: dfn-no-such-alert
9494
text: no such element; url: dfn-no-such-element
9595
text: no such frame; url: dfn-no-such-frame
96+
text: no such response; url: dfn-no-such-response
97+
text: no response body; url: dfn-no-response-body
9698
text: parse a page range; url: dfn-parse-a-page-range
9799
text: handler; for: prompt handler configuration; url: dfn-handler
98100
text: process capabilities; url: dfn-capabilities-processing
@@ -659,6 +661,7 @@ ErrorCode = "invalid argument" /
659661
"invalid session id" /
660662
"invalid web extension" /
661663
"move target out of bounds" /
664+
"no response body" /
662665
"no such alert" /
663666
"no such element" /
664667
"no such frame" /
@@ -667,6 +670,7 @@ ErrorCode = "invalid argument" /
667670
"no such intercept" /
668671
"no such node" /
669672
"no such request" /
673+
"no such response" /
670674
"no such script" /
671675
"no such storage partition" /
672676
"no such user context" /
@@ -5283,6 +5287,7 @@ NetworkCommand = (
52835287
network.ContinueResponse //
52845288
network.ContinueWithAuth //
52855289
network.FailRequest //
5290+
network.GetResponseBody //
52865291
network.ProvideResponse //
52875292
network.RemoveIntercept //
52885293
network.SetCacheBehavior
@@ -5312,6 +5317,9 @@ A [=remote end=] has a <dfn>before request sent map</dfn> which is initially an
53125317
empty map. It's used to track the network events for which a
53135318
<code>network.beforeRequestSent</code> event has already been sent.
53145319

5320+
A [=remote end=] has a <dfn>response map</dfn> that maps a [=request id=]
5321+
to [=/response=]. Implementations may remove data from [=response map=] map at any time.
5322+
53155323
A [=remote end=] has a <dfn>default cache behavior</dfn> which is a string. It is
53165324
initially "<code>default</code>".
53175325

@@ -7056,6 +7064,59 @@ The [=remote end steps=] given |session| and |command parameters| are:
70567064

70577065
</div>
70587066

7067+
#### The network.getResponseBody Command #### {#command-network-getResponseBody}
7068+
7069+
The <dfn export for=commands>network.getResponseBody</dfn> command retrieved the
7070+
response body data if it is available.
7071+
7072+
<dl>
7073+
<dt>Command Type</dt>
7074+
<dd>
7075+
<pre class="cddl remote-cddl">
7076+
network.GetResponseBody = (
7077+
method: "network.getResponseBody",
7078+
params: network.GetResponseBodyParameters
7079+
)
7080+
7081+
network.GetResponseBodyParameters = {
7082+
request: network.Request,
7083+
}
7084+
</pre>
7085+
</dd>
7086+
<dt>Return Type</dt>
7087+
<dd>
7088+
<pre class="cddl local-cddl">
7089+
script.GetResponseBodyResult = {
7090+
body: network.BytesValue,
7091+
}
7092+
</pre>
7093+
</dd>
7094+
</dl>
7095+
7096+
<div algorithm="remote end steps for network.getResponseBody">
7097+
The [=remote end steps=] given <var ignore>session</var> and |command parameters| are:
7098+
7099+
1. Let |request id| be |command parameters|["<code>request</code>"].
7100+
7101+
1. If [=response map=] does not [=map/contain=] |request id|:
7102+
7103+
1. Return [=error=] with [=error code=] [=no such response=].
7104+
7105+
1. Let |response| be [=response map=][|request id|].
7106+
7107+
1. If |response|'s [=response/body=] is null,
7108+
7109+
1. Return [=error=] with [=error code=] [=no response body=].
7110+
7111+
1. Let |body| be a [=/map=] matching the <code>script.GetResponseBodyResult</code> production,
7112+
with the <code>body</code> field set to base-64 encoded value of |response|'s [=response/body=].
7113+
TODO: specify exact steps how to read the body.
7114+
7115+
1. Return [=success=] with data |body|.
7116+
7117+
</div>
7118+
7119+
70597120
#### The network.provideResponse Command #### {#command-network-provideResponse}
70607121

70617122
The <dfn export for=commands>network.provideResponse</dfn> command continues a
@@ -7553,6 +7614,9 @@ completed</dfn> steps given |request| and |response|:
75537614
[=request/client=]. Otherwise let |related navigables| be an empty
75547615
set.
75557616

7617+
1. If the implementation is configured to save response data for |request|,
7618+
set [=response map=][|request|'s [=request id=]] to |response|.
7619+
75567620
1. For each |session| in the [=set of sessions for which an event is enabled=]
75577621
given "<code>network.responseCompleted</code>" and |related navigables|:
75587622

0 commit comments

Comments
 (0)