Skip to content

Commit 014577e

Browse files
Copilotrbri
andauthored
Stabilize async ordering in ResponseTest bodyMethods
Agent-Logs-Url: https://github.com/HtmlUnit/htmlunit/sessions/eb4c0531-5e18-4a8b-ba4f-99434cfa82bf Co-authored-by: rbri <2544132+rbri@users.noreply.github.com>
1 parent 48c2765 commit 014577e

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/test/java/org/htmlunit/javascript/host/fetch/ResponseTest.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,18 @@ public void bodyMethods() throws Exception {
8282
final String html = DOCTYPE_HTML
8383
+ "<html><head><script>\n"
8484
+ LOG_TITLE_FUNCTION
85-
+ " new Response('{\"a\":1}').json().then(v => log(typeof v));\n"
86-
+ " new Response('{\"a\":1}').json().then(v => log(v.a));\n"
87-
+ " new Response('abc').arrayBuffer().then(b => log(b.byteLength));\n"
88-
+ " new Response('abc').blob().then(b => log(b.size));\n"
89-
+ " new Response('q=v&x=y', {headers: {'content-type': 'application/x-www-form-urlencoded'}})\n"
90-
+ " .formData().then(f => { log(f.get('q')); log(f.get('x')); });\n"
85+
+ " Promise.resolve()\n"
86+
+ " .then(() => new Response('{\"a\":1}').json())\n"
87+
+ " .then(v => log(typeof v))\n"
88+
+ " .then(() => new Response('{\"a\":1}').json())\n"
89+
+ " .then(v => log(v.a))\n"
90+
+ " .then(() => new Response('abc').arrayBuffer())\n"
91+
+ " .then(b => log(b.byteLength))\n"
92+
+ " .then(() => new Response('abc').blob())\n"
93+
+ " .then(b => log(b.size))\n"
94+
+ " .then(() => new Response('q=v&x=y',\n"
95+
+ " {headers: {'content-type': 'application/x-www-form-urlencoded'}}).formData())\n"
96+
+ " .then(f => { log(f.get('q')); log(f.get('x')); });\n"
9197
+ "</script></head><body></body></html>";
9298

9399
final WebDriver driver = loadPage2(html);

0 commit comments

Comments
 (0)