这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion kits/javascript/shims/types/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 9 additions & 1 deletion kits/javascript/shims/types/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
Binary file modified kits/javascript/wasm-workers-quick-js-engine.wasm
Binary file not shown.