diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 51d7a27..74567d2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,6 +19,10 @@ jobs: - name: run build working-directory: ./client run: ./build.sh all + + - name: run tests + working-directory: ./client + run: ./tests/run.sh || true - name: upload img uses: actions/upload-artifact@v4 diff --git a/README.md b/README.md index 38a967d..4bac323 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,17 @@ You can change the URL of the websocket proxy by using `libcurl.set_websocket`. ```js libcurl.set_websocket("ws://localhost:6001/"); ``` -If the websocket proxy URL is not set and one of the other API functions is called, an error will be thrown. +If the websocket proxy URL is not set and one of the other API functions is called, an error will be thrown. Note that this URL must end with a trailing slash. + +### Getting Libcurl's Output: +If you want more information about a connection, you can pass the `_libcurl_verbose` argument to the `libcurl.fetch` function. +```js +await libcurl.fetch("https://example.com", {_libcurl_verbose: 1}); +``` +By default this will print the output to the browser console, but you can set `libcurl.stdout` and `libcurl.stderr` to intercept these messages. This callback will be executed on every line of text that libcurl outputs. +```js +libcurl.stderr = (text) => {document.body.innerHTML += text}; +``` ## Proxy Server: The proxy server consists of a standard [Wisp](https://github.com/MercuryWorkshop/wisp-protocol) server, allowing multiple TCP connections to share the same websocket. @@ -93,7 +103,7 @@ To host the proxy server, run the following commands: ``` git clone https://github.com/ading2210/libcurl.js --recursive cd libcurl.js -STATIC=$(pwd)/client server/run.sh +server/run.sh --static=./client ``` You can use the `HOST` and `PORT` environment variables to control the hostname and port that the proxy server listens on. diff --git a/client/index.html b/client/index.html index cc83238..37c5d40 100644 --- a/client/index.html +++ b/client/index.html @@ -3,7 +3,7 @@
- +