Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta: Added an HTTP echo server to help with testing Browser JS #1801

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

coryvirok
Copy link
Contributor

This allows us to simulate HTTP responses from Browser JS tests. Instead of using hacks like data URLs to "load" external data, we can now generate an actual HTTP response that contains arbitrary headers, body, and has a defined response delay.

Run the server, serving all files in ./Tests at http://localhost:8000/static/:

python ./Meta/dev-echo-server.py -d ./Tests

Visit http://localhost:8000 for usage information.

This allows us to simulate HTTP responses from Browser JS tests.
Instead of using hacks like data URLs to "load" external data,
we can now generate an actual HTTP response that contains
arbitrary headers, body, and has a defined response delay.

Run the server:
python ./Meta/dev-echo-server.py -d ./Tests

Visit http://localhost:8000 for usage information.
The test server will be started and backgrounded before the LibWeb
suite of tests runs. This makes it possible to load static files in
./Tests/ using http://localhost:8000/static/path-to-file.

If you'd like to run a LibWeb test outside of the harness, (ie by
loading the HTML file from disk directly in the browser) you will
want to first start the http-test-server by hand:

> python ./Meta/http-test-server.py -d ./Tests
The example shows how to write a test that depends on custom HTTP
headers in the response. This will be useful for testing browser JS
that depends on how Ladybird processes response headers, eg CORS
headers like Access-Control-Allow-Origin and others.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant