diff --git a/kits/javascript/shims/types/headers.js b/kits/javascript/shims/types/headers.js index f3365a12..73d14974 100644 --- a/kits/javascript/shims/types/headers.js +++ b/kits/javascript/shims/types/headers.js @@ -9,7 +9,12 @@ class Headers { // Initialize the headers for (const key in initialHeaders) { - headers[key] = initialHeaders[key]; + let value = initialHeaders[key]; + + // Allow only string values + if (typeof value === "string") { + headers[key] = value; + } } this.headers = headers; diff --git a/kits/javascript/shims/types/response.js b/kits/javascript/shims/types/response.js index ad42136e..df341b71 100644 --- a/kits/javascript/shims/types/response.js +++ b/kits/javascript/shims/types/response.js @@ -10,7 +10,15 @@ import httpStatus from "http-status"; class Response { constructor(body, options = {}) { this.body = body; - this.headers = new Headers(options.headers || {}); + + if (options.headers instanceof Headers) { + this.headers = options.headers; + } else if (options.headers instanceof Object) { + this.headers = new Headers(options.headers); + } else { + this.headers = new Headers({}); + } + this.status = options.status || 200; this.statusText = options.statusText || httpStatus[this.status]; } diff --git a/kits/javascript/wasm-workers-quick-js-engine.wasm b/kits/javascript/wasm-workers-quick-js-engine.wasm index 26f15970..77a5d241 100755 Binary files a/kits/javascript/wasm-workers-quick-js-engine.wasm and b/kits/javascript/wasm-workers-quick-js-engine.wasm differ