@modelcontextprotocol/server-system-monitor 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -33227,15 +33227,14 @@ var Response2 = class _Response {
33227
33227
  this.#init = init;
33228
33228
  }
33229
33229
  if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
33230
- headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
33231
- this[cacheKey] = [init?.status || 200, body, headers];
33230
+ this[cacheKey] = [init?.status || 200, body, headers || init?.headers];
33232
33231
  }
33233
33232
  }
33234
33233
  get headers() {
33235
33234
  const cache = this[cacheKey];
33236
33235
  if (cache) {
33237
33236
  if (!(cache[2] instanceof Headers)) {
33238
- cache[2] = new Headers(cache[2]);
33237
+ cache[2] = new Headers(cache[2] || { "content-type": "text/plain; charset=UTF-8" });
33239
33238
  }
33240
33239
  return cache[2];
33241
33240
  }
@@ -33329,17 +33328,9 @@ var buildOutgoingHttpHeaders = (headers) => {
33329
33328
  return res;
33330
33329
  };
33331
33330
  var X_ALREADY_SENT = "x-hono-already-sent";
33332
- var webFetch = global.fetch;
33333
33331
  if (typeof global.crypto === "undefined") {
33334
33332
  global.crypto = crypto2;
33335
33333
  }
33336
- global.fetch = (info, init) => {
33337
- init = {
33338
- compress: false,
33339
- ...init
33340
- };
33341
- return webFetch(info, init);
33342
- };
33343
33334
  var outgoingEnded = Symbol("outgoingEnded");
33344
33335
  var handleRequestError = () => new Response(null, {
33345
33336
  status: 400
@@ -33367,15 +33358,32 @@ var flushHeaders = (outgoing) => {
33367
33358
  };
33368
33359
  var responseViaCache = async (res, outgoing) => {
33369
33360
  let [status, body, header] = res[cacheKey];
33370
- if (header instanceof Headers) {
33361
+ let hasContentLength = false;
33362
+ if (!header) {
33363
+ header = { "content-type": "text/plain; charset=UTF-8" };
33364
+ } else if (header instanceof Headers) {
33365
+ hasContentLength = header.has("content-length");
33371
33366
  header = buildOutgoingHttpHeaders(header);
33367
+ } else if (Array.isArray(header)) {
33368
+ const headerObj = new Headers(header);
33369
+ hasContentLength = headerObj.has("content-length");
33370
+ header = buildOutgoingHttpHeaders(headerObj);
33371
+ } else {
33372
+ for (const key in header) {
33373
+ if (key.length === 14 && key.toLowerCase() === "content-length") {
33374
+ hasContentLength = true;
33375
+ break;
33376
+ }
33377
+ }
33372
33378
  }
33373
- if (typeof body === "string") {
33374
- header["Content-Length"] = Buffer.byteLength(body);
33375
- } else if (body instanceof Uint8Array) {
33376
- header["Content-Length"] = body.byteLength;
33377
- } else if (body instanceof Blob) {
33378
- header["Content-Length"] = body.size;
33379
+ if (!hasContentLength) {
33380
+ if (typeof body === "string") {
33381
+ header["Content-Length"] = Buffer.byteLength(body);
33382
+ } else if (body instanceof Uint8Array) {
33383
+ header["Content-Length"] = body.byteLength;
33384
+ } else if (body instanceof Blob) {
33385
+ header["Content-Length"] = body.size;
33386
+ }
33379
33387
  }
33380
33388
  outgoing.writeHead(status, header);
33381
33389
  if (typeof body === "string" || body instanceof Uint8Array) {