@hono/node-server 1.7.0 → 1.8.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 +79 -39
- package/dist/index.mjs +79 -39
- package/dist/listener.js +79 -39
- package/dist/listener.mjs +79 -39
- package/dist/request.d.mts +2 -1
- package/dist/request.d.ts +2 -1
- package/dist/request.js +16 -4
- package/dist/request.mjs +15 -4
- package/dist/response.d.mts +9 -2
- package/dist/response.d.ts +9 -2
- package/dist/response.js +27 -8
- package/dist/response.mjs +25 -7
- package/dist/serve-static.js +6 -28
- package/dist/serve-static.mjs +6 -28
- package/dist/server.js +79 -39
- package/dist/server.mjs +79 -39
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/dist/vercel.js +79 -39
- package/dist/vercel.mjs +79 -39
- package/package.json +2 -2
package/dist/vercel.js
CHANGED
|
@@ -53,7 +53,7 @@ var Request = class extends GlobalRequest {
|
|
|
53
53
|
Object.defineProperty(global, "Request", {
|
|
54
54
|
value: Request
|
|
55
55
|
});
|
|
56
|
-
var newRequestFromIncoming = (method, url, incoming) => {
|
|
56
|
+
var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
57
57
|
const headerRecord = [];
|
|
58
58
|
const rawHeaders = incoming.rawHeaders;
|
|
59
59
|
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
@@ -65,7 +65,8 @@ var newRequestFromIncoming = (method, url, incoming) => {
|
|
|
65
65
|
}
|
|
66
66
|
const init = {
|
|
67
67
|
method,
|
|
68
|
-
headers: headerRecord
|
|
68
|
+
headers: headerRecord,
|
|
69
|
+
signal: abortController.signal
|
|
69
70
|
};
|
|
70
71
|
if (!(method === "GET" || method === "HEAD")) {
|
|
71
72
|
init.body = import_node_stream.Readable.toWeb(incoming);
|
|
@@ -76,6 +77,8 @@ var getRequestCache = Symbol("getRequestCache");
|
|
|
76
77
|
var requestCache = Symbol("requestCache");
|
|
77
78
|
var incomingKey = Symbol("incomingKey");
|
|
78
79
|
var urlKey = Symbol("urlKey");
|
|
80
|
+
var abortControllerKey = Symbol("abortControllerKey");
|
|
81
|
+
var getAbortController = Symbol("getAbortController");
|
|
79
82
|
var requestPrototype = {
|
|
80
83
|
get method() {
|
|
81
84
|
return this[incomingKey].method || "GET";
|
|
@@ -83,11 +86,17 @@ var requestPrototype = {
|
|
|
83
86
|
get url() {
|
|
84
87
|
return this[urlKey];
|
|
85
88
|
},
|
|
89
|
+
[getAbortController]() {
|
|
90
|
+
this[getRequestCache]();
|
|
91
|
+
return this[abortControllerKey];
|
|
92
|
+
},
|
|
86
93
|
[getRequestCache]() {
|
|
94
|
+
this[abortControllerKey] ||= new AbortController();
|
|
87
95
|
return this[requestCache] ||= newRequestFromIncoming(
|
|
88
96
|
this.method,
|
|
89
97
|
this[urlKey],
|
|
90
|
-
this[incomingKey]
|
|
98
|
+
this[incomingKey],
|
|
99
|
+
this[abortControllerKey]
|
|
91
100
|
);
|
|
92
101
|
}
|
|
93
102
|
};
|
|
@@ -103,7 +112,8 @@ var requestPrototype = {
|
|
|
103
112
|
"redirect",
|
|
104
113
|
"referrer",
|
|
105
114
|
"referrerPolicy",
|
|
106
|
-
"signal"
|
|
115
|
+
"signal",
|
|
116
|
+
"keepalive"
|
|
107
117
|
].forEach((k) => {
|
|
108
118
|
Object.defineProperty(requestPrototype, k, {
|
|
109
119
|
get() {
|
|
@@ -181,18 +191,19 @@ var buildOutgoingHttpHeaders = (headers) => {
|
|
|
181
191
|
if (cookies.length > 0) {
|
|
182
192
|
res["set-cookie"] = cookies;
|
|
183
193
|
}
|
|
184
|
-
res["content-type"] ??= "text/plain;charset=UTF-8";
|
|
194
|
+
res["content-type"] ??= "text/plain; charset=UTF-8";
|
|
185
195
|
return res;
|
|
186
196
|
};
|
|
187
197
|
|
|
188
198
|
// src/response.ts
|
|
189
199
|
var responseCache = Symbol("responseCache");
|
|
200
|
+
var getResponseCache = Symbol("getResponseCache");
|
|
190
201
|
var cacheKey = Symbol("cache");
|
|
191
202
|
var GlobalResponse = global.Response;
|
|
192
203
|
var Response2 = class _Response {
|
|
193
204
|
#body;
|
|
194
205
|
#init;
|
|
195
|
-
|
|
206
|
+
[getResponseCache]() {
|
|
196
207
|
delete this[cacheKey];
|
|
197
208
|
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
|
198
209
|
}
|
|
@@ -202,7 +213,7 @@ var Response2 = class _Response {
|
|
|
202
213
|
const cachedGlobalResponse = init[responseCache];
|
|
203
214
|
if (cachedGlobalResponse) {
|
|
204
215
|
this.#init = cachedGlobalResponse;
|
|
205
|
-
this
|
|
216
|
+
this[getResponseCache]();
|
|
206
217
|
return;
|
|
207
218
|
} else {
|
|
208
219
|
this.#init = init.#init;
|
|
@@ -211,7 +222,7 @@ var Response2 = class _Response {
|
|
|
211
222
|
this.#init = init;
|
|
212
223
|
}
|
|
213
224
|
if (typeof body === "string" || body instanceof ReadableStream) {
|
|
214
|
-
let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
|
|
225
|
+
let headers = init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
|
215
226
|
if (headers instanceof Headers) {
|
|
216
227
|
headers = buildOutgoingHttpHeaders(headers);
|
|
217
228
|
}
|
|
@@ -234,14 +245,14 @@ var Response2 = class _Response {
|
|
|
234
245
|
].forEach((k) => {
|
|
235
246
|
Object.defineProperty(Response2.prototype, k, {
|
|
236
247
|
get() {
|
|
237
|
-
return this
|
|
248
|
+
return this[getResponseCache]()[k];
|
|
238
249
|
}
|
|
239
250
|
});
|
|
240
251
|
});
|
|
241
252
|
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
|
242
253
|
Object.defineProperty(Response2.prototype, k, {
|
|
243
254
|
value: function() {
|
|
244
|
-
return this
|
|
255
|
+
return this[getResponseCache]()[k]();
|
|
245
256
|
}
|
|
246
257
|
});
|
|
247
258
|
});
|
|
@@ -250,6 +261,22 @@ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
|
|
250
261
|
Object.defineProperty(global, "Response", {
|
|
251
262
|
value: Response2
|
|
252
263
|
});
|
|
264
|
+
var stateKey = Reflect.ownKeys(new GlobalResponse()).find(
|
|
265
|
+
(k) => typeof k === "symbol" && k.toString() === "Symbol(state)"
|
|
266
|
+
);
|
|
267
|
+
if (!stateKey) {
|
|
268
|
+
console.warn("Failed to find Response internal state key");
|
|
269
|
+
}
|
|
270
|
+
function getInternalBody(response) {
|
|
271
|
+
if (!stateKey) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (response instanceof Response2) {
|
|
275
|
+
response = response[getResponseCache]();
|
|
276
|
+
}
|
|
277
|
+
const state = response[stateKey];
|
|
278
|
+
return state && state.body || void 0;
|
|
279
|
+
}
|
|
253
280
|
|
|
254
281
|
// src/globals.ts
|
|
255
282
|
var import_node_crypto = __toESM(require("crypto"));
|
|
@@ -315,36 +342,40 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
315
342
|
res = await res.catch(handleFetchError);
|
|
316
343
|
}
|
|
317
344
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
if (isCached) {
|
|
321
|
-
return responseViaCache(res, outgoing);
|
|
322
|
-
}
|
|
323
|
-
} catch (e) {
|
|
324
|
-
return handleResponseError(e, outgoing);
|
|
345
|
+
if (cacheKey in res) {
|
|
346
|
+
return responseViaCache(res, outgoing);
|
|
325
347
|
}
|
|
326
348
|
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
349
|
+
const internalBody = getInternalBody(res);
|
|
350
|
+
if (internalBody) {
|
|
351
|
+
if (internalBody.length) {
|
|
352
|
+
resHeaderRecord["content-length"] = internalBody.length;
|
|
353
|
+
}
|
|
354
|
+
outgoing.writeHead(res.status, resHeaderRecord);
|
|
355
|
+
if (typeof internalBody.source === "string" || internalBody.source instanceof Uint8Array) {
|
|
356
|
+
outgoing.end(internalBody.source);
|
|
357
|
+
} else if (internalBody.source instanceof Blob) {
|
|
358
|
+
outgoing.end(new Uint8Array(await internalBody.source.arrayBuffer()));
|
|
359
|
+
} else {
|
|
360
|
+
await writeFromReadableStream(internalBody.stream, outgoing);
|
|
361
|
+
}
|
|
362
|
+
} else if (res.body) {
|
|
363
|
+
const {
|
|
364
|
+
"transfer-encoding": transferEncoding,
|
|
365
|
+
"content-encoding": contentEncoding,
|
|
366
|
+
"content-length": contentLength,
|
|
367
|
+
"x-accel-buffering": accelBuffering,
|
|
368
|
+
"content-type": contentType
|
|
369
|
+
} = resHeaderRecord;
|
|
370
|
+
if (transferEncoding || contentEncoding || contentLength || // nginx buffering variant
|
|
371
|
+
accelBuffering && regBuffer.test(accelBuffering) || !regContentType.test(contentType)) {
|
|
372
|
+
outgoing.writeHead(res.status, resHeaderRecord);
|
|
373
|
+
await writeFromReadableStream(res.body, outgoing);
|
|
374
|
+
} else {
|
|
375
|
+
const buffer = await res.arrayBuffer();
|
|
376
|
+
resHeaderRecord["content-length"] = buffer.byteLength;
|
|
377
|
+
outgoing.writeHead(res.status, resHeaderRecord);
|
|
378
|
+
outgoing.end(new Uint8Array(buffer));
|
|
348
379
|
}
|
|
349
380
|
} else {
|
|
350
381
|
outgoing.writeHead(res.status, resHeaderRecord);
|
|
@@ -355,6 +386,11 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
355
386
|
return async (incoming, outgoing) => {
|
|
356
387
|
let res;
|
|
357
388
|
const req = newRequest(incoming);
|
|
389
|
+
outgoing.on("close", () => {
|
|
390
|
+
if (incoming.destroyed) {
|
|
391
|
+
req[getAbortController]().abort();
|
|
392
|
+
}
|
|
393
|
+
});
|
|
358
394
|
try {
|
|
359
395
|
res = fetchCallback(req, { incoming, outgoing });
|
|
360
396
|
if (cacheKey in res) {
|
|
@@ -374,7 +410,11 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
374
410
|
return handleResponseError(e, outgoing);
|
|
375
411
|
}
|
|
376
412
|
}
|
|
377
|
-
|
|
413
|
+
try {
|
|
414
|
+
return responseViaResponseObject(res, outgoing, options);
|
|
415
|
+
} catch (e) {
|
|
416
|
+
return handleResponseError(e, outgoing);
|
|
417
|
+
}
|
|
378
418
|
};
|
|
379
419
|
};
|
|
380
420
|
|
package/dist/vercel.mjs
CHANGED
|
@@ -17,7 +17,7 @@ var Request = class extends GlobalRequest {
|
|
|
17
17
|
Object.defineProperty(global, "Request", {
|
|
18
18
|
value: Request
|
|
19
19
|
});
|
|
20
|
-
var newRequestFromIncoming = (method, url, incoming) => {
|
|
20
|
+
var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
21
21
|
const headerRecord = [];
|
|
22
22
|
const rawHeaders = incoming.rawHeaders;
|
|
23
23
|
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
@@ -29,7 +29,8 @@ var newRequestFromIncoming = (method, url, incoming) => {
|
|
|
29
29
|
}
|
|
30
30
|
const init = {
|
|
31
31
|
method,
|
|
32
|
-
headers: headerRecord
|
|
32
|
+
headers: headerRecord,
|
|
33
|
+
signal: abortController.signal
|
|
33
34
|
};
|
|
34
35
|
if (!(method === "GET" || method === "HEAD")) {
|
|
35
36
|
init.body = Readable.toWeb(incoming);
|
|
@@ -40,6 +41,8 @@ var getRequestCache = Symbol("getRequestCache");
|
|
|
40
41
|
var requestCache = Symbol("requestCache");
|
|
41
42
|
var incomingKey = Symbol("incomingKey");
|
|
42
43
|
var urlKey = Symbol("urlKey");
|
|
44
|
+
var abortControllerKey = Symbol("abortControllerKey");
|
|
45
|
+
var getAbortController = Symbol("getAbortController");
|
|
43
46
|
var requestPrototype = {
|
|
44
47
|
get method() {
|
|
45
48
|
return this[incomingKey].method || "GET";
|
|
@@ -47,11 +50,17 @@ var requestPrototype = {
|
|
|
47
50
|
get url() {
|
|
48
51
|
return this[urlKey];
|
|
49
52
|
},
|
|
53
|
+
[getAbortController]() {
|
|
54
|
+
this[getRequestCache]();
|
|
55
|
+
return this[abortControllerKey];
|
|
56
|
+
},
|
|
50
57
|
[getRequestCache]() {
|
|
58
|
+
this[abortControllerKey] ||= new AbortController();
|
|
51
59
|
return this[requestCache] ||= newRequestFromIncoming(
|
|
52
60
|
this.method,
|
|
53
61
|
this[urlKey],
|
|
54
|
-
this[incomingKey]
|
|
62
|
+
this[incomingKey],
|
|
63
|
+
this[abortControllerKey]
|
|
55
64
|
);
|
|
56
65
|
}
|
|
57
66
|
};
|
|
@@ -67,7 +76,8 @@ var requestPrototype = {
|
|
|
67
76
|
"redirect",
|
|
68
77
|
"referrer",
|
|
69
78
|
"referrerPolicy",
|
|
70
|
-
"signal"
|
|
79
|
+
"signal",
|
|
80
|
+
"keepalive"
|
|
71
81
|
].forEach((k) => {
|
|
72
82
|
Object.defineProperty(requestPrototype, k, {
|
|
73
83
|
get() {
|
|
@@ -145,18 +155,19 @@ var buildOutgoingHttpHeaders = (headers) => {
|
|
|
145
155
|
if (cookies.length > 0) {
|
|
146
156
|
res["set-cookie"] = cookies;
|
|
147
157
|
}
|
|
148
|
-
res["content-type"] ??= "text/plain;charset=UTF-8";
|
|
158
|
+
res["content-type"] ??= "text/plain; charset=UTF-8";
|
|
149
159
|
return res;
|
|
150
160
|
};
|
|
151
161
|
|
|
152
162
|
// src/response.ts
|
|
153
163
|
var responseCache = Symbol("responseCache");
|
|
164
|
+
var getResponseCache = Symbol("getResponseCache");
|
|
154
165
|
var cacheKey = Symbol("cache");
|
|
155
166
|
var GlobalResponse = global.Response;
|
|
156
167
|
var Response2 = class _Response {
|
|
157
168
|
#body;
|
|
158
169
|
#init;
|
|
159
|
-
|
|
170
|
+
[getResponseCache]() {
|
|
160
171
|
delete this[cacheKey];
|
|
161
172
|
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
|
162
173
|
}
|
|
@@ -166,7 +177,7 @@ var Response2 = class _Response {
|
|
|
166
177
|
const cachedGlobalResponse = init[responseCache];
|
|
167
178
|
if (cachedGlobalResponse) {
|
|
168
179
|
this.#init = cachedGlobalResponse;
|
|
169
|
-
this
|
|
180
|
+
this[getResponseCache]();
|
|
170
181
|
return;
|
|
171
182
|
} else {
|
|
172
183
|
this.#init = init.#init;
|
|
@@ -175,7 +186,7 @@ var Response2 = class _Response {
|
|
|
175
186
|
this.#init = init;
|
|
176
187
|
}
|
|
177
188
|
if (typeof body === "string" || body instanceof ReadableStream) {
|
|
178
|
-
let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
|
|
189
|
+
let headers = init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
|
179
190
|
if (headers instanceof Headers) {
|
|
180
191
|
headers = buildOutgoingHttpHeaders(headers);
|
|
181
192
|
}
|
|
@@ -198,14 +209,14 @@ var Response2 = class _Response {
|
|
|
198
209
|
].forEach((k) => {
|
|
199
210
|
Object.defineProperty(Response2.prototype, k, {
|
|
200
211
|
get() {
|
|
201
|
-
return this
|
|
212
|
+
return this[getResponseCache]()[k];
|
|
202
213
|
}
|
|
203
214
|
});
|
|
204
215
|
});
|
|
205
216
|
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
|
206
217
|
Object.defineProperty(Response2.prototype, k, {
|
|
207
218
|
value: function() {
|
|
208
|
-
return this
|
|
219
|
+
return this[getResponseCache]()[k]();
|
|
209
220
|
}
|
|
210
221
|
});
|
|
211
222
|
});
|
|
@@ -214,6 +225,22 @@ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
|
|
214
225
|
Object.defineProperty(global, "Response", {
|
|
215
226
|
value: Response2
|
|
216
227
|
});
|
|
228
|
+
var stateKey = Reflect.ownKeys(new GlobalResponse()).find(
|
|
229
|
+
(k) => typeof k === "symbol" && k.toString() === "Symbol(state)"
|
|
230
|
+
);
|
|
231
|
+
if (!stateKey) {
|
|
232
|
+
console.warn("Failed to find Response internal state key");
|
|
233
|
+
}
|
|
234
|
+
function getInternalBody(response) {
|
|
235
|
+
if (!stateKey) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (response instanceof Response2) {
|
|
239
|
+
response = response[getResponseCache]();
|
|
240
|
+
}
|
|
241
|
+
const state = response[stateKey];
|
|
242
|
+
return state && state.body || void 0;
|
|
243
|
+
}
|
|
217
244
|
|
|
218
245
|
// src/globals.ts
|
|
219
246
|
import crypto from "crypto";
|
|
@@ -279,36 +306,40 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
279
306
|
res = await res.catch(handleFetchError);
|
|
280
307
|
}
|
|
281
308
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
if (isCached) {
|
|
285
|
-
return responseViaCache(res, outgoing);
|
|
286
|
-
}
|
|
287
|
-
} catch (e) {
|
|
288
|
-
return handleResponseError(e, outgoing);
|
|
309
|
+
if (cacheKey in res) {
|
|
310
|
+
return responseViaCache(res, outgoing);
|
|
289
311
|
}
|
|
290
312
|
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
313
|
+
const internalBody = getInternalBody(res);
|
|
314
|
+
if (internalBody) {
|
|
315
|
+
if (internalBody.length) {
|
|
316
|
+
resHeaderRecord["content-length"] = internalBody.length;
|
|
317
|
+
}
|
|
318
|
+
outgoing.writeHead(res.status, resHeaderRecord);
|
|
319
|
+
if (typeof internalBody.source === "string" || internalBody.source instanceof Uint8Array) {
|
|
320
|
+
outgoing.end(internalBody.source);
|
|
321
|
+
} else if (internalBody.source instanceof Blob) {
|
|
322
|
+
outgoing.end(new Uint8Array(await internalBody.source.arrayBuffer()));
|
|
323
|
+
} else {
|
|
324
|
+
await writeFromReadableStream(internalBody.stream, outgoing);
|
|
325
|
+
}
|
|
326
|
+
} else if (res.body) {
|
|
327
|
+
const {
|
|
328
|
+
"transfer-encoding": transferEncoding,
|
|
329
|
+
"content-encoding": contentEncoding,
|
|
330
|
+
"content-length": contentLength,
|
|
331
|
+
"x-accel-buffering": accelBuffering,
|
|
332
|
+
"content-type": contentType
|
|
333
|
+
} = resHeaderRecord;
|
|
334
|
+
if (transferEncoding || contentEncoding || contentLength || // nginx buffering variant
|
|
335
|
+
accelBuffering && regBuffer.test(accelBuffering) || !regContentType.test(contentType)) {
|
|
336
|
+
outgoing.writeHead(res.status, resHeaderRecord);
|
|
337
|
+
await writeFromReadableStream(res.body, outgoing);
|
|
338
|
+
} else {
|
|
339
|
+
const buffer = await res.arrayBuffer();
|
|
340
|
+
resHeaderRecord["content-length"] = buffer.byteLength;
|
|
341
|
+
outgoing.writeHead(res.status, resHeaderRecord);
|
|
342
|
+
outgoing.end(new Uint8Array(buffer));
|
|
312
343
|
}
|
|
313
344
|
} else {
|
|
314
345
|
outgoing.writeHead(res.status, resHeaderRecord);
|
|
@@ -319,6 +350,11 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
319
350
|
return async (incoming, outgoing) => {
|
|
320
351
|
let res;
|
|
321
352
|
const req = newRequest(incoming);
|
|
353
|
+
outgoing.on("close", () => {
|
|
354
|
+
if (incoming.destroyed) {
|
|
355
|
+
req[getAbortController]().abort();
|
|
356
|
+
}
|
|
357
|
+
});
|
|
322
358
|
try {
|
|
323
359
|
res = fetchCallback(req, { incoming, outgoing });
|
|
324
360
|
if (cacheKey in res) {
|
|
@@ -338,7 +374,11 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
338
374
|
return handleResponseError(e, outgoing);
|
|
339
375
|
}
|
|
340
376
|
}
|
|
341
|
-
|
|
377
|
+
try {
|
|
378
|
+
return responseViaResponseObject(res, outgoing, options);
|
|
379
|
+
} catch (e) {
|
|
380
|
+
return handleResponseError(e, outgoing);
|
|
381
|
+
}
|
|
342
382
|
};
|
|
343
383
|
};
|
|
344
384
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hono/node-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Node.js Adapter for Hono",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@types/supertest": "^2.0.12",
|
|
71
71
|
"@whatwg-node/fetch": "^0.9.14",
|
|
72
72
|
"eslint": "^8.55.0",
|
|
73
|
-
"hono": "^
|
|
73
|
+
"hono": "^4.0.3",
|
|
74
74
|
"jest": "^29.6.1",
|
|
75
75
|
"np": "^7.7.0",
|
|
76
76
|
"prettier": "^3.2.4",
|