@@ -55658,15 +55658,17 @@ var Response2 = class _Response {
5565855658 this.#init = init;
5565955659 }
5566055660 if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
55661- headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" } ;
55662- this[cacheKey] = [init?.status || 200, body, headers];
55661+ ;
55662+ this[cacheKey] = [init?.status || 200, body, headers || init?.headers ];
5566355663 }
5566455664 }
5566555665 get headers() {
5566655666 const cache = this[cacheKey];
5566755667 if (cache) {
5566855668 if (!(cache[2] instanceof Headers)) {
55669- cache[2] = new Headers(cache[2]);
55669+ cache[2] = new Headers(
55670+ cache[2] || { "content-type": "text/plain; charset=UTF-8" }
55671+ );
5567055672 }
5567155673 return cache[2];
5567255674 }
@@ -55791,15 +55793,32 @@ var flushHeaders = (outgoing) => {
5579155793};
5579255794var responseViaCache = async (res, outgoing) => {
5579355795 let [status, body, header] = res[cacheKey];
55794- if (header instanceof Headers) {
55796+ let hasContentLength = false;
55797+ if (!header) {
55798+ header = { "content-type": "text/plain; charset=UTF-8" };
55799+ } else if (header instanceof Headers) {
55800+ hasContentLength = header.has("content-length");
5579555801 header = buildOutgoingHttpHeaders(header);
55802+ } else if (Array.isArray(header)) {
55803+ const headerObj = new Headers(header);
55804+ hasContentLength = headerObj.has("content-length");
55805+ header = buildOutgoingHttpHeaders(headerObj);
55806+ } else {
55807+ for (const key in header) {
55808+ if (key.length === 14 && key.toLowerCase() === "content-length") {
55809+ hasContentLength = true;
55810+ break;
55811+ }
55812+ }
5579655813 }
55797- if (typeof body === "string") {
55798- header["Content-Length"] = Buffer.byteLength(body);
55799- } else if (body instanceof Uint8Array) {
55800- header["Content-Length"] = body.byteLength;
55801- } else if (body instanceof Blob) {
55802- header["Content-Length"] = body.size;
55814+ if (!hasContentLength) {
55815+ if (typeof body === "string") {
55816+ header["Content-Length"] = Buffer.byteLength(body);
55817+ } else if (body instanceof Uint8Array) {
55818+ header["Content-Length"] = body.byteLength;
55819+ } else if (body instanceof Blob) {
55820+ header["Content-Length"] = body.size;
55821+ }
5580355822 }
5580455823 outgoing.writeHead(status, header);
5580555824 if (typeof body === "string" || body instanceof Uint8Array) {
@@ -65618,7 +65637,7 @@ init_package_paths();
6561865637init_logger();
6561965638import_dotenv.default.config({ path: resolve12(packageRootDir, ".env"), quiet: true });
6562065639var PACKAGE_NAME = "codeql-development-mcp-server";
65621- var VERSION = "2.24.2 ";
65640+ var VERSION = "2.24.3 ";
6562265641async function startServer(mode = "stdio") {
6562365642 logger.info(`Starting CodeQL Development MCP McpServer v${VERSION} in ${mode} mode`);
6562465643 const codeqlBinary = resolveCodeQLBinary();
0 commit comments