Skip to content

Commit

Permalink
fix: http headers support (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford authored Oct 27, 2023
1 parent c62320d commit b3a2de4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"terser": "^5.16.1"
},
"devDependencies": {
"@bytecodealliance/componentize-js": "^0.4.0",
"@bytecodealliance/componentize-js": "^0.4.1",
"@types/node": "^18.11.17",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
Expand Down
6 changes: 2 additions & 4 deletions test/fixtures/componentize/wasi-http-proxy/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ const sendRequest = (
}

const status = incomingResponse.status();
// const h = incomingResponse.headers();
// const responseHeaders = incomingResponse.headers().entries();
const responseHeaders = incomingResponse.headers().entries();

const decoder = new TextDecoder();
// const headers = responseHeaders.map(([k, v]) => [k, decoder.decode(v)]);
const headers = [];
const headers = responseHeaders.map(([k, v]) => [k, decoder.decode(v)]);

let responseBody;
const incomingBody = incomingResponse.consume();
Expand Down
12 changes: 6 additions & 6 deletions test/runtime/wasi-http-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { commands, incomingHandler } from '../output/wasi-http-proxy/wasi-http-p
// const { IncomingRequest, ResponseOutparam } = types;

const defaultHeaders: [string, string][] = [
// ['connection', 'keep-alive'],
// ['content-type', 'text/plain'],
// ['date', 'null'],
// ['keep-alive', 'timeout=5'],
// ['transfer-encoding', 'chunked'],
// ['x-wasi', 'mock-server'],
['connection', 'keep-alive'],
['content-type', 'text/plain'],
['date', 'null'],
['keep-alive', 'timeout=5'],
['transfer-encoding', 'chunked'],
['x-wasi', 'mock-server'],
];

assert.equal(
Expand Down

0 comments on commit b3a2de4

Please sign in to comment.