Skip to content

Commit

Permalink
example: allow browser using its user-agent
Browse files Browse the repository at this point in the history
Signed-off-by: Kohei Tokunaga <[email protected]>
  • Loading branch information
ktock committed Sep 14, 2023
1 parent 38ab1f0 commit ff03e50
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/wasi-browser/htdocs/stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ function connect(name, shared, conn, certbuf) {
var reqObj = JSON.parse(new TextDecoder().decode(req_.req));
reqObj.mode = "cors";
reqObj.credentials = "omit";
if (reqObj.headers && reqObj.headers["User-Agent"] != "") {
delete reqObj.headers["User-Agent"]; // Browser will add its own value.
}
var reqID = getID();
if (reqID < 0) {
console.log(name + ":" + "failed to get id");
Expand Down

0 comments on commit ff03e50

Please sign in to comment.