Skip to content

Commit 36c48ce

Browse files
committed
fix last contribution
1 parent 12f25e1 commit 36c48ce

3 files changed

Lines changed: 29 additions & 13 deletions

File tree

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,10 @@
13151315
<name>Marcos Vinicius B. de Souza</name>
13161316
<email>marvin.java@gmail.com</email>
13171317
</contributor>
1318+
<contributor>
1319+
<name>Jakob Ackermann</name>
1320+
<email>das7pad@outlook.com</email>
1321+
</contributor>
13181322
</contributors>
13191323
<dependencies>
13201324
<!-- this includes httpclient as depencency -->

src/main/resources/org/htmlunit/javascript/polyfill/fetch/.editorconfig

Lines changed: 0 additions & 2 deletions
This file was deleted.

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

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,9 @@ public void fetchGetJson() throws Exception {
303303
"[object\\sBlob]", "4", "text/plain;charset=iso-8859-1"},
304304
FF_ESR = {"200", "OK", "true", "text/plain;charset=iso-8859-1",
305305
"[object\\sBlob]", "4", "text/plain;charset=iso-8859-1"})
306-
@HtmlUnitNYI(FF = {"200", "OK", "true", "text/plain;charset=iso-8859-1",
307-
"[object\\sBlob]", "4", "text/plain"},
306+
@HtmlUnitNYI(
307+
FF = {"200", "OK", "true", "text/plain;charset=iso-8859-1",
308+
"[object\\sBlob]", "4", "text/plain"},
308309
FF_ESR = {"200", "OK", "true", "text/plain;charset=iso-8859-1",
309310
"[object\\sBlob]", "4", "text/plain"})
310311
public void fetchGetBlob() throws Exception {
@@ -514,7 +515,7 @@ public void fetchPostFormData() throws Exception {
514515
* @throws Exception if the test fails
515516
*/
516517
@Test
517-
@Alerts({"200", "OK", "true"})
518+
@Alerts({"200", "OK", "true", "[object\\sPromise]§Hello1\\nHello1", "Hello2\\nHello2"})
518519
public void fetchMultipartFormData() throws Exception {
519520
final String html = DOCTYPE_HTML
520521
+ "<html>\n"
@@ -526,23 +527,37 @@ public void fetchMultipartFormData() throws Exception {
526527
+ " log(response.status);\n"
527528
+ " log(response.statusText);\n"
528529
+ " log(response.ok);\n"
529-
+ " })\n"
530-
+ " .then(response => {\n"
531-
+ " return response.formData();\n"
530+
531+
+ " let fd = response.formData();"
532+
+ " log(fd);\n"
533+
+ " return fd;\n"
532534
+ " })\n"
533535
+ " .then(formData => {\n"
534536
+ " log(formData.get('test0'));\n"
535537
+ " log(formData.get('test1'));\n"
536538
+ " })\n"
537-
+ " .catch(e => logEx(e));\n"
539+
+ " .catch(e => log(e.message));\n"
538540
+ " </script>\n"
539541
+ " </body>\n"
540542
+ "</html>";
541543

542-
final String content = "--0123456789\r\nContent-Disposition: form-data;name=test0\r\nContent-Type: text/plain\r\nHello1\nHello1\r\n--0123456789\r\nContent-Disposition: form-data;name=test1\r\nContent-Type: text/plain\r\nHello2\nHello2\r\n--0123456789--";
543-
getMockWebConnection().setResponse(URL_SECOND, content, "multipart/form-data; boundary=0123456789");
544+
final String boundary = "0123456789";
545+
final String content = "--" + boundary + "\r\n"
546+
+ "Content-Disposition: form-data; name=\"test0\"\r\n"
547+
+ "Content-Type: text/plain\r\n"
548+
+ "\r\n"
549+
+ "Hello1\nHello1\r\n"
550+
+ "--" + boundary + "\r\n"
551+
+ "Content-Disposition: form-data; name=\"test1\"\r\n"
552+
+ "Content-Type: text/plain\r\n"
553+
+ "\r\n"
554+
+ "Hello2\nHello2\r\n"
555+
+ "--" + boundary + "--";
556+
557+
getMockWebConnection().setResponse(URL_SECOND, content, "multipart/form-data; boundary=" + boundary);
544558

545-
final WebDriver driver = loadPage2(html);
559+
final WebDriver driver = enableFetchPolyfill();
560+
loadPage2(html);
546561
verifyTitle2(DEFAULT_WAIT_TIME, driver, getExpectedAlerts());
547562

548563
assertEquals(URL_SECOND, getMockWebConnection().getLastWebRequest().getUrl());
@@ -552,7 +567,6 @@ public void fetchMultipartFormData() throws Exception {
552567
* @throws Exception if the test fails
553568
*/
554569
@Test
555-
@Disabled
556570
@Alerts({"200", "OK", "true"})
557571
public void fetchPostURLSearchParams() throws Exception {
558572
final String html = DOCTYPE_HTML

0 commit comments

Comments
 (0)