@whatwg-node/server 0.4.10 → 0.4.11

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.
Files changed (3) hide show
  1. package/index.js +4 -4
  2. package/index.mjs +4 -4
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -145,8 +145,8 @@ async function sendNodeResponse({ headers, status, statusText, body }, serverRes
145
145
  }
146
146
  else if (isReadable(body)) {
147
147
  serverResponse.once('close', () => {
148
- resolve();
149
148
  body.destroy();
149
+ resolve();
150
150
  });
151
151
  body.pipe(serverResponse);
152
152
  }
@@ -255,9 +255,9 @@ RequestCtor = fetch.Request) {
255
255
  if (typeof input === 'string' || input instanceof URL) {
256
256
  const [initOrCtx, ...restOfCtx] = maybeCtx;
257
257
  if (isRequestInit(initOrCtx)) {
258
- return handleRequestWithWaitUntil(new RequestCtor(input.toString(), initOrCtx), ...restOfCtx);
258
+ return handleRequestWithWaitUntil(new RequestCtor(input, initOrCtx), ...restOfCtx);
259
259
  }
260
- return handleRequestWithWaitUntil(new RequestCtor(input.toString()), ...maybeCtx);
260
+ return handleRequestWithWaitUntil(new RequestCtor(input), ...maybeCtx);
261
261
  }
262
262
  return handleRequestWithWaitUntil(input, ...maybeCtx);
263
263
  };
@@ -271,7 +271,7 @@ RequestCtor = fetch.Request) {
271
271
  return requestListener(input, initOrCtxOrRes, ...restOfCtx);
272
272
  }
273
273
  if (isServerResponse(initOrCtxOrRes)) {
274
- throw new Error('Got Node response without Node request');
274
+ throw new TypeError('Got Node response without Node request');
275
275
  }
276
276
  // Is input a container object over Request?
277
277
  if (typeof input === 'object' && 'request' in input) {
package/index.mjs CHANGED
@@ -141,8 +141,8 @@ async function sendNodeResponse({ headers, status, statusText, body }, serverRes
141
141
  }
142
142
  else if (isReadable(body)) {
143
143
  serverResponse.once('close', () => {
144
- resolve();
145
144
  body.destroy();
145
+ resolve();
146
146
  });
147
147
  body.pipe(serverResponse);
148
148
  }
@@ -251,9 +251,9 @@ RequestCtor = Request) {
251
251
  if (typeof input === 'string' || input instanceof URL) {
252
252
  const [initOrCtx, ...restOfCtx] = maybeCtx;
253
253
  if (isRequestInit(initOrCtx)) {
254
- return handleRequestWithWaitUntil(new RequestCtor(input.toString(), initOrCtx), ...restOfCtx);
254
+ return handleRequestWithWaitUntil(new RequestCtor(input, initOrCtx), ...restOfCtx);
255
255
  }
256
- return handleRequestWithWaitUntil(new RequestCtor(input.toString()), ...maybeCtx);
256
+ return handleRequestWithWaitUntil(new RequestCtor(input), ...maybeCtx);
257
257
  }
258
258
  return handleRequestWithWaitUntil(input, ...maybeCtx);
259
259
  };
@@ -267,7 +267,7 @@ RequestCtor = Request) {
267
267
  return requestListener(input, initOrCtxOrRes, ...restOfCtx);
268
268
  }
269
269
  if (isServerResponse(initOrCtxOrRes)) {
270
- throw new Error('Got Node response without Node request');
270
+ throw new TypeError('Got Node response without Node request');
271
271
  }
272
272
  // Is input a container object over Request?
273
273
  if (typeof input === 'object' && 'request' in input) {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@whatwg-node/server",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "Fetch API compliant HTTP Server adapter",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
7
  "@types/node": "^18.0.6"
8
8
  },
9
9
  "dependencies": {
10
- "@whatwg-node/fetch": "0.4.6",
10
+ "@whatwg-node/fetch": "0.4.7",
11
11
  "tslib": "^2.3.1"
12
12
  },
13
13
  "repository": {