diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txt index dfe342a7a54..92fc025af76 100644 --- a/Tests/LibWeb/Text/expected/all-window-properties.txt +++ b/Tests/LibWeb/Text/expected/all-window-properties.txt @@ -408,6 +408,7 @@ __finishTest __preventMultipleTestFunctions animationFrame asyncTest +httpTestServer printElement println promiseTest diff --git a/Tests/LibWeb/Text/expected/test-http-test-server.txt b/Tests/LibWeb/Text/expected/test-http-test-server.txt new file mode 100644 index 00000000000..7ef22e9a431 --- /dev/null +++ b/Tests/LibWeb/Text/expected/test-http-test-server.txt @@ -0,0 +1 @@ +PASS diff --git a/Tests/LibWeb/Text/input/include.js b/Tests/LibWeb/Text/input/include.js index 7ac4f1d0923..2b643c7649d 100644 --- a/Tests/LibWeb/Text/input/include.js +++ b/Tests/LibWeb/Text/input/include.js @@ -98,3 +98,31 @@ function promiseTest(f) { }); }); } + +class HTTPTestServer { + constructor(baseURL) { + this.baseURL = baseURL; + } + async createEcho(method, path, options) { + const result = await fetch(`${this.baseURL}/create`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ ...options, method, path }), + }); + if (!result.ok) { + throw new Error("Error creating echo: " + result.statusText); + } + return `${this.baseURL}${path}`; + } + getStaticURL(path) { + return `${this.baseURL}/static/${path}`; + } +} + +// FIXME: Get the port from internals +const __httpTestServer = new HTTPTestServer("http://localhost:8123"); +function httpTestServer() { + return __httpTestServer; +} diff --git a/Tests/LibWeb/Text/input/test-http-test-server.html b/Tests/LibWeb/Text/input/test-http-test-server.html new file mode 100644 index 00000000000..46a213b0d7d --- /dev/null +++ b/Tests/LibWeb/Text/input/test-http-test-server.html @@ -0,0 +1,29 @@ + +