@hono/node-server 1.3.4 → 1.3.5

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
@@ -281,19 +281,12 @@ var responseViaResponseObject = async (res, outgoing) => {
281
281
  if (res instanceof Promise) {
282
282
  res = await res.catch(handleFetchError);
283
283
  }
284
- if (!(res instanceof Response)) {
285
- return handleResponseError(
286
- // @ts-expect-error the object must have `toString()`
287
- new Error(`The response is not an instance of Response, but ${res.toString()}`),
288
- outgoing
289
- );
290
- }
291
- if (cacheKey in res) {
292
- try {
284
+ try {
285
+ if (cacheKey in res) {
293
286
  return responseViaCache(res, outgoing);
294
- } catch (e) {
295
- return handleResponseError(e, outgoing);
296
287
  }
288
+ } catch (e) {
289
+ return handleResponseError(e, outgoing);
297
290
  }
298
291
  const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
299
292
  if (res.body) {
package/dist/index.mjs CHANGED
@@ -243,19 +243,12 @@ var responseViaResponseObject = async (res, outgoing) => {
243
243
  if (res instanceof Promise) {
244
244
  res = await res.catch(handleFetchError);
245
245
  }
246
- if (!(res instanceof Response)) {
247
- return handleResponseError(
248
- // @ts-expect-error the object must have `toString()`
249
- new Error(`The response is not an instance of Response, but ${res.toString()}`),
250
- outgoing
251
- );
252
- }
253
- if (cacheKey in res) {
254
- try {
246
+ try {
247
+ if (cacheKey in res) {
255
248
  return responseViaCache(res, outgoing);
256
- } catch (e) {
257
- return handleResponseError(e, outgoing);
258
249
  }
250
+ } catch (e) {
251
+ return handleResponseError(e, outgoing);
259
252
  }
260
253
  const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
261
254
  if (res.body) {
package/dist/listener.js CHANGED
@@ -276,19 +276,12 @@ var responseViaResponseObject = async (res, outgoing) => {
276
276
  if (res instanceof Promise) {
277
277
  res = await res.catch(handleFetchError);
278
278
  }
279
- if (!(res instanceof Response)) {
280
- return handleResponseError(
281
- // @ts-expect-error the object must have `toString()`
282
- new Error(`The response is not an instance of Response, but ${res.toString()}`),
283
- outgoing
284
- );
285
- }
286
- if (cacheKey in res) {
287
- try {
279
+ try {
280
+ if (cacheKey in res) {
288
281
  return responseViaCache(res, outgoing);
289
- } catch (e) {
290
- return handleResponseError(e, outgoing);
291
282
  }
283
+ } catch (e) {
284
+ return handleResponseError(e, outgoing);
292
285
  }
293
286
  const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
294
287
  if (res.body) {
package/dist/listener.mjs CHANGED
@@ -240,19 +240,12 @@ var responseViaResponseObject = async (res, outgoing) => {
240
240
  if (res instanceof Promise) {
241
241
  res = await res.catch(handleFetchError);
242
242
  }
243
- if (!(res instanceof Response)) {
244
- return handleResponseError(
245
- // @ts-expect-error the object must have `toString()`
246
- new Error(`The response is not an instance of Response, but ${res.toString()}`),
247
- outgoing
248
- );
249
- }
250
- if (cacheKey in res) {
251
- try {
243
+ try {
244
+ if (cacheKey in res) {
252
245
  return responseViaCache(res, outgoing);
253
- } catch (e) {
254
- return handleResponseError(e, outgoing);
255
246
  }
247
+ } catch (e) {
248
+ return handleResponseError(e, outgoing);
256
249
  }
257
250
  const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
258
251
  if (res.body) {
package/dist/server.js CHANGED
@@ -278,19 +278,12 @@ var responseViaResponseObject = async (res, outgoing) => {
278
278
  if (res instanceof Promise) {
279
279
  res = await res.catch(handleFetchError);
280
280
  }
281
- if (!(res instanceof Response)) {
282
- return handleResponseError(
283
- // @ts-expect-error the object must have `toString()`
284
- new Error(`The response is not an instance of Response, but ${res.toString()}`),
285
- outgoing
286
- );
287
- }
288
- if (cacheKey in res) {
289
- try {
281
+ try {
282
+ if (cacheKey in res) {
290
283
  return responseViaCache(res, outgoing);
291
- } catch (e) {
292
- return handleResponseError(e, outgoing);
293
284
  }
285
+ } catch (e) {
286
+ return handleResponseError(e, outgoing);
294
287
  }
295
288
  const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
296
289
  if (res.body) {
package/dist/server.mjs CHANGED
@@ -243,19 +243,12 @@ var responseViaResponseObject = async (res, outgoing) => {
243
243
  if (res instanceof Promise) {
244
244
  res = await res.catch(handleFetchError);
245
245
  }
246
- if (!(res instanceof Response)) {
247
- return handleResponseError(
248
- // @ts-expect-error the object must have `toString()`
249
- new Error(`The response is not an instance of Response, but ${res.toString()}`),
250
- outgoing
251
- );
252
- }
253
- if (cacheKey in res) {
254
- try {
246
+ try {
247
+ if (cacheKey in res) {
255
248
  return responseViaCache(res, outgoing);
256
- } catch (e) {
257
- return handleResponseError(e, outgoing);
258
249
  }
250
+ } catch (e) {
251
+ return handleResponseError(e, outgoing);
259
252
  }
260
253
  const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
261
254
  if (res.body) {
package/dist/vercel.js CHANGED
@@ -276,19 +276,12 @@ var responseViaResponseObject = async (res, outgoing) => {
276
276
  if (res instanceof Promise) {
277
277
  res = await res.catch(handleFetchError);
278
278
  }
279
- if (!(res instanceof Response)) {
280
- return handleResponseError(
281
- // @ts-expect-error the object must have `toString()`
282
- new Error(`The response is not an instance of Response, but ${res.toString()}`),
283
- outgoing
284
- );
285
- }
286
- if (cacheKey in res) {
287
- try {
279
+ try {
280
+ if (cacheKey in res) {
288
281
  return responseViaCache(res, outgoing);
289
- } catch (e) {
290
- return handleResponseError(e, outgoing);
291
282
  }
283
+ } catch (e) {
284
+ return handleResponseError(e, outgoing);
292
285
  }
293
286
  const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
294
287
  if (res.body) {
package/dist/vercel.mjs CHANGED
@@ -240,19 +240,12 @@ var responseViaResponseObject = async (res, outgoing) => {
240
240
  if (res instanceof Promise) {
241
241
  res = await res.catch(handleFetchError);
242
242
  }
243
- if (!(res instanceof Response)) {
244
- return handleResponseError(
245
- // @ts-expect-error the object must have `toString()`
246
- new Error(`The response is not an instance of Response, but ${res.toString()}`),
247
- outgoing
248
- );
249
- }
250
- if (cacheKey in res) {
251
- try {
243
+ try {
244
+ if (cacheKey in res) {
252
245
  return responseViaCache(res, outgoing);
253
- } catch (e) {
254
- return handleResponseError(e, outgoing);
255
246
  }
247
+ } catch (e) {
248
+ return handleResponseError(e, outgoing);
256
249
  }
257
250
  const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
258
251
  if (res.body) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/node-server",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Node.js Adapter for Hono",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -66,6 +66,7 @@
66
66
  "@types/jest": "^29.5.3",
67
67
  "@types/node": "^20.10.0",
68
68
  "@types/supertest": "^2.0.12",
69
+ "@whatwg-node/fetch": "^0.9.14",
69
70
  "eslint": "^8.55.0",
70
71
  "hono": "^3.11.7",
71
72
  "jest": "^29.6.1",