@hono/node-server 1.13.6 → 1.13.8
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 +17 -2
- package/dist/index.mjs +17 -2
- package/dist/listener.js +17 -2
- package/dist/listener.mjs +17 -2
- package/dist/request.d.mts +2 -1
- package/dist/request.d.ts +2 -1
- package/dist/request.js +12 -1
- package/dist/request.mjs +11 -1
- package/dist/server.js +17 -2
- package/dist/server.mjs +17 -2
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/vercel.js +17 -2
- package/dist/vercel.mjs +17 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -94,7 +94,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
|
94
94
|
return req;
|
|
95
95
|
}
|
|
96
96
|
if (!(method === "GET" || method === "HEAD")) {
|
|
97
|
-
|
|
97
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
|
98
|
+
init.body = new ReadableStream({
|
|
99
|
+
start(controller) {
|
|
100
|
+
controller.enqueue(incoming.rawBody);
|
|
101
|
+
controller.close();
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
init.body = import_node_stream.Readable.toWeb(incoming);
|
|
106
|
+
}
|
|
98
107
|
}
|
|
99
108
|
return new Request(url, init);
|
|
100
109
|
};
|
|
@@ -442,8 +451,14 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
442
451
|
try {
|
|
443
452
|
req = newRequest(incoming, options.hostname);
|
|
444
453
|
outgoing.on("close", () => {
|
|
454
|
+
const abortController = req[abortControllerKey];
|
|
455
|
+
if (!abortController) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
445
458
|
if (incoming.errored) {
|
|
446
|
-
req[
|
|
459
|
+
req[abortControllerKey].abort(incoming.errored.toString());
|
|
460
|
+
} else if (!outgoing.writableFinished) {
|
|
461
|
+
req[abortControllerKey].abort("Client connection prematurely closed.");
|
|
447
462
|
}
|
|
448
463
|
});
|
|
449
464
|
res = fetchCallback(req, { incoming, outgoing });
|
package/dist/index.mjs
CHANGED
|
@@ -55,7 +55,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
|
55
55
|
return req;
|
|
56
56
|
}
|
|
57
57
|
if (!(method === "GET" || method === "HEAD")) {
|
|
58
|
-
|
|
58
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
|
59
|
+
init.body = new ReadableStream({
|
|
60
|
+
start(controller) {
|
|
61
|
+
controller.enqueue(incoming.rawBody);
|
|
62
|
+
controller.close();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
init.body = Readable.toWeb(incoming);
|
|
67
|
+
}
|
|
59
68
|
}
|
|
60
69
|
return new Request(url, init);
|
|
61
70
|
};
|
|
@@ -403,8 +412,14 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
403
412
|
try {
|
|
404
413
|
req = newRequest(incoming, options.hostname);
|
|
405
414
|
outgoing.on("close", () => {
|
|
415
|
+
const abortController = req[abortControllerKey];
|
|
416
|
+
if (!abortController) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
406
419
|
if (incoming.errored) {
|
|
407
|
-
req[
|
|
420
|
+
req[abortControllerKey].abort(incoming.errored.toString());
|
|
421
|
+
} else if (!outgoing.writableFinished) {
|
|
422
|
+
req[abortControllerKey].abort("Client connection prematurely closed.");
|
|
408
423
|
}
|
|
409
424
|
});
|
|
410
425
|
res = fetchCallback(req, { incoming, outgoing });
|
package/dist/listener.js
CHANGED
|
@@ -88,7 +88,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
|
88
88
|
return req;
|
|
89
89
|
}
|
|
90
90
|
if (!(method === "GET" || method === "HEAD")) {
|
|
91
|
-
|
|
91
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
|
92
|
+
init.body = new ReadableStream({
|
|
93
|
+
start(controller) {
|
|
94
|
+
controller.enqueue(incoming.rawBody);
|
|
95
|
+
controller.close();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
init.body = import_node_stream.Readable.toWeb(incoming);
|
|
100
|
+
}
|
|
92
101
|
}
|
|
93
102
|
return new Request(url, init);
|
|
94
103
|
};
|
|
@@ -436,8 +445,14 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
436
445
|
try {
|
|
437
446
|
req = newRequest(incoming, options.hostname);
|
|
438
447
|
outgoing.on("close", () => {
|
|
448
|
+
const abortController = req[abortControllerKey];
|
|
449
|
+
if (!abortController) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
439
452
|
if (incoming.errored) {
|
|
440
|
-
req[
|
|
453
|
+
req[abortControllerKey].abort(incoming.errored.toString());
|
|
454
|
+
} else if (!outgoing.writableFinished) {
|
|
455
|
+
req[abortControllerKey].abort("Client connection prematurely closed.");
|
|
441
456
|
}
|
|
442
457
|
});
|
|
443
458
|
res = fetchCallback(req, { incoming, outgoing });
|
package/dist/listener.mjs
CHANGED
|
@@ -52,7 +52,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
|
52
52
|
return req;
|
|
53
53
|
}
|
|
54
54
|
if (!(method === "GET" || method === "HEAD")) {
|
|
55
|
-
|
|
55
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
|
56
|
+
init.body = new ReadableStream({
|
|
57
|
+
start(controller) {
|
|
58
|
+
controller.enqueue(incoming.rawBody);
|
|
59
|
+
controller.close();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
init.body = Readable.toWeb(incoming);
|
|
64
|
+
}
|
|
56
65
|
}
|
|
57
66
|
return new Request(url, init);
|
|
58
67
|
};
|
|
@@ -400,8 +409,14 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
400
409
|
try {
|
|
401
410
|
req = newRequest(incoming, options.hostname);
|
|
402
411
|
outgoing.on("close", () => {
|
|
412
|
+
const abortController = req[abortControllerKey];
|
|
413
|
+
if (!abortController) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
403
416
|
if (incoming.errored) {
|
|
404
|
-
req[
|
|
417
|
+
req[abortControllerKey].abort(incoming.errored.toString());
|
|
418
|
+
} else if (!outgoing.writableFinished) {
|
|
419
|
+
req[abortControllerKey].abort("Client connection prematurely closed.");
|
|
405
420
|
}
|
|
406
421
|
});
|
|
407
422
|
res = fetchCallback(req, { incoming, outgoing });
|
package/dist/request.d.mts
CHANGED
|
@@ -15,7 +15,8 @@ declare const GlobalRequest: {
|
|
|
15
15
|
declare class Request extends GlobalRequest {
|
|
16
16
|
constructor(input: string | Request, options?: RequestInit);
|
|
17
17
|
}
|
|
18
|
+
declare const abortControllerKey: unique symbol;
|
|
18
19
|
declare const getAbortController: unique symbol;
|
|
19
20
|
declare const newRequest: (incoming: IncomingMessage | Http2ServerRequest, defaultHostname?: string) => any;
|
|
20
21
|
|
|
21
|
-
export { GlobalRequest, Request, RequestError, getAbortController, newRequest, toRequestError };
|
|
22
|
+
export { GlobalRequest, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError };
|
package/dist/request.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ declare const GlobalRequest: {
|
|
|
15
15
|
declare class Request extends GlobalRequest {
|
|
16
16
|
constructor(input: string | Request, options?: RequestInit);
|
|
17
17
|
}
|
|
18
|
+
declare const abortControllerKey: unique symbol;
|
|
18
19
|
declare const getAbortController: unique symbol;
|
|
19
20
|
declare const newRequest: (incoming: IncomingMessage | Http2ServerRequest, defaultHostname?: string) => any;
|
|
20
21
|
|
|
21
|
-
export { GlobalRequest, Request, RequestError, getAbortController, newRequest, toRequestError };
|
|
22
|
+
export { GlobalRequest, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError };
|
package/dist/request.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(request_exports, {
|
|
|
23
23
|
GlobalRequest: () => GlobalRequest,
|
|
24
24
|
Request: () => Request,
|
|
25
25
|
RequestError: () => RequestError,
|
|
26
|
+
abortControllerKey: () => abortControllerKey,
|
|
26
27
|
getAbortController: () => getAbortController,
|
|
27
28
|
newRequest: () => newRequest,
|
|
28
29
|
toRequestError: () => toRequestError
|
|
@@ -81,7 +82,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
|
81
82
|
return req;
|
|
82
83
|
}
|
|
83
84
|
if (!(method === "GET" || method === "HEAD")) {
|
|
84
|
-
|
|
85
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
|
86
|
+
init.body = new ReadableStream({
|
|
87
|
+
start(controller) {
|
|
88
|
+
controller.enqueue(incoming.rawBody);
|
|
89
|
+
controller.close();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
init.body = import_node_stream.Readable.toWeb(incoming);
|
|
94
|
+
}
|
|
85
95
|
}
|
|
86
96
|
return new Request(url, init);
|
|
87
97
|
};
|
|
@@ -162,6 +172,7 @@ var newRequest = (incoming, defaultHostname) => {
|
|
|
162
172
|
GlobalRequest,
|
|
163
173
|
Request,
|
|
164
174
|
RequestError,
|
|
175
|
+
abortControllerKey,
|
|
165
176
|
getAbortController,
|
|
166
177
|
newRequest,
|
|
167
178
|
toRequestError
|
package/dist/request.mjs
CHANGED
|
@@ -52,7 +52,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
|
52
52
|
return req;
|
|
53
53
|
}
|
|
54
54
|
if (!(method === "GET" || method === "HEAD")) {
|
|
55
|
-
|
|
55
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
|
56
|
+
init.body = new ReadableStream({
|
|
57
|
+
start(controller) {
|
|
58
|
+
controller.enqueue(incoming.rawBody);
|
|
59
|
+
controller.close();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
init.body = Readable.toWeb(incoming);
|
|
64
|
+
}
|
|
56
65
|
}
|
|
57
66
|
return new Request(url, init);
|
|
58
67
|
};
|
|
@@ -132,6 +141,7 @@ export {
|
|
|
132
141
|
GlobalRequest,
|
|
133
142
|
Request,
|
|
134
143
|
RequestError,
|
|
144
|
+
abortControllerKey,
|
|
135
145
|
getAbortController,
|
|
136
146
|
newRequest,
|
|
137
147
|
toRequestError
|
package/dist/server.js
CHANGED
|
@@ -90,7 +90,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
|
90
90
|
return req;
|
|
91
91
|
}
|
|
92
92
|
if (!(method === "GET" || method === "HEAD")) {
|
|
93
|
-
|
|
93
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
|
94
|
+
init.body = new ReadableStream({
|
|
95
|
+
start(controller) {
|
|
96
|
+
controller.enqueue(incoming.rawBody);
|
|
97
|
+
controller.close();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
init.body = import_node_stream.Readable.toWeb(incoming);
|
|
102
|
+
}
|
|
94
103
|
}
|
|
95
104
|
return new Request(url, init);
|
|
96
105
|
};
|
|
@@ -438,8 +447,14 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
438
447
|
try {
|
|
439
448
|
req = newRequest(incoming, options.hostname);
|
|
440
449
|
outgoing.on("close", () => {
|
|
450
|
+
const abortController = req[abortControllerKey];
|
|
451
|
+
if (!abortController) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
441
454
|
if (incoming.errored) {
|
|
442
|
-
req[
|
|
455
|
+
req[abortControllerKey].abort(incoming.errored.toString());
|
|
456
|
+
} else if (!outgoing.writableFinished) {
|
|
457
|
+
req[abortControllerKey].abort("Client connection prematurely closed.");
|
|
443
458
|
}
|
|
444
459
|
});
|
|
445
460
|
res = fetchCallback(req, { incoming, outgoing });
|
package/dist/server.mjs
CHANGED
|
@@ -55,7 +55,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
|
55
55
|
return req;
|
|
56
56
|
}
|
|
57
57
|
if (!(method === "GET" || method === "HEAD")) {
|
|
58
|
-
|
|
58
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
|
59
|
+
init.body = new ReadableStream({
|
|
60
|
+
start(controller) {
|
|
61
|
+
controller.enqueue(incoming.rawBody);
|
|
62
|
+
controller.close();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
init.body = Readable.toWeb(incoming);
|
|
67
|
+
}
|
|
59
68
|
}
|
|
60
69
|
return new Request(url, init);
|
|
61
70
|
};
|
|
@@ -403,8 +412,14 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
403
412
|
try {
|
|
404
413
|
req = newRequest(incoming, options.hostname);
|
|
405
414
|
outgoing.on("close", () => {
|
|
415
|
+
const abortController = req[abortControllerKey];
|
|
416
|
+
if (!abortController) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
406
419
|
if (incoming.errored) {
|
|
407
|
-
req[
|
|
420
|
+
req[abortControllerKey].abort(incoming.errored.toString());
|
|
421
|
+
} else if (!outgoing.writableFinished) {
|
|
422
|
+
req[abortControllerKey].abort("Client connection prematurely closed.");
|
|
408
423
|
}
|
|
409
424
|
});
|
|
410
425
|
res = fetchCallback(req, { incoming, outgoing });
|
package/dist/types.d.mts
CHANGED
|
@@ -40,4 +40,4 @@ type Options = {
|
|
|
40
40
|
} & ServerOptions;
|
|
41
41
|
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
|
42
42
|
|
|
43
|
-
export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerType };
|
|
43
|
+
export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
package/dist/types.d.ts
CHANGED
|
@@ -40,4 +40,4 @@ type Options = {
|
|
|
40
40
|
} & ServerOptions;
|
|
41
41
|
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
|
42
42
|
|
|
43
|
-
export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerType };
|
|
43
|
+
export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
package/dist/vercel.js
CHANGED
|
@@ -88,7 +88,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
|
88
88
|
return req;
|
|
89
89
|
}
|
|
90
90
|
if (!(method === "GET" || method === "HEAD")) {
|
|
91
|
-
|
|
91
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
|
92
|
+
init.body = new ReadableStream({
|
|
93
|
+
start(controller) {
|
|
94
|
+
controller.enqueue(incoming.rawBody);
|
|
95
|
+
controller.close();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
init.body = import_node_stream.Readable.toWeb(incoming);
|
|
100
|
+
}
|
|
92
101
|
}
|
|
93
102
|
return new Request(url, init);
|
|
94
103
|
};
|
|
@@ -436,8 +445,14 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
436
445
|
try {
|
|
437
446
|
req = newRequest(incoming, options.hostname);
|
|
438
447
|
outgoing.on("close", () => {
|
|
448
|
+
const abortController = req[abortControllerKey];
|
|
449
|
+
if (!abortController) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
439
452
|
if (incoming.errored) {
|
|
440
|
-
req[
|
|
453
|
+
req[abortControllerKey].abort(incoming.errored.toString());
|
|
454
|
+
} else if (!outgoing.writableFinished) {
|
|
455
|
+
req[abortControllerKey].abort("Client connection prematurely closed.");
|
|
441
456
|
}
|
|
442
457
|
});
|
|
443
458
|
res = fetchCallback(req, { incoming, outgoing });
|
package/dist/vercel.mjs
CHANGED
|
@@ -52,7 +52,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
|
52
52
|
return req;
|
|
53
53
|
}
|
|
54
54
|
if (!(method === "GET" || method === "HEAD")) {
|
|
55
|
-
|
|
55
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
|
56
|
+
init.body = new ReadableStream({
|
|
57
|
+
start(controller) {
|
|
58
|
+
controller.enqueue(incoming.rawBody);
|
|
59
|
+
controller.close();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
init.body = Readable.toWeb(incoming);
|
|
64
|
+
}
|
|
56
65
|
}
|
|
57
66
|
return new Request(url, init);
|
|
58
67
|
};
|
|
@@ -400,8 +409,14 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
400
409
|
try {
|
|
401
410
|
req = newRequest(incoming, options.hostname);
|
|
402
411
|
outgoing.on("close", () => {
|
|
412
|
+
const abortController = req[abortControllerKey];
|
|
413
|
+
if (!abortController) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
403
416
|
if (incoming.errored) {
|
|
404
|
-
req[
|
|
417
|
+
req[abortControllerKey].abort(incoming.errored.toString());
|
|
418
|
+
} else if (!outgoing.writableFinished) {
|
|
419
|
+
req[abortControllerKey].abort("Client connection prematurely closed.");
|
|
405
420
|
}
|
|
406
421
|
});
|
|
407
422
|
res = fetchCallback(req, { incoming, outgoing });
|