hono 4.9.6 → 4.9.7
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.
|
@@ -25,7 +25,7 @@ module.exports = __toCommonJS(fetch_result_please_exports);
|
|
|
25
25
|
const nullBodyResponses = /* @__PURE__ */ new Set([101, 204, 205, 304]);
|
|
26
26
|
async function fetchRP(fetchRes) {
|
|
27
27
|
const _fetchRes = await fetchRes;
|
|
28
|
-
const hasBody = _fetchRes.body && !nullBodyResponses.has(_fetchRes.status);
|
|
28
|
+
const hasBody = (_fetchRes.body || _fetchRes._bodyInit) && !nullBodyResponses.has(_fetchRes.status);
|
|
29
29
|
if (hasBody) {
|
|
30
30
|
const responseType = detectResponseType(_fetchRes);
|
|
31
31
|
_fetchRes._data = await _fetchRes[responseType]();
|
|
@@ -41,7 +41,11 @@ const bodyLimit = (options) => {
|
|
|
41
41
|
if (!c.req.raw.body) {
|
|
42
42
|
return next();
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
const hasTransferEncoding = c.req.raw.headers.has("transfer-encoding");
|
|
45
|
+
const hasContentLength = c.req.raw.headers.has("content-length");
|
|
46
|
+
if (hasTransferEncoding && hasContentLength) {
|
|
47
|
+
}
|
|
48
|
+
if (hasContentLength && !hasTransferEncoding) {
|
|
45
49
|
const contentLength = parseInt(c.req.raw.headers.get("content-length") || "0", 10);
|
|
46
50
|
return contentLength > maxSize ? onError(c) : next();
|
|
47
51
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var nullBodyResponses = /* @__PURE__ */ new Set([101, 204, 205, 304]);
|
|
3
3
|
async function fetchRP(fetchRes) {
|
|
4
4
|
const _fetchRes = await fetchRes;
|
|
5
|
-
const hasBody = _fetchRes.body && !nullBodyResponses.has(_fetchRes.status);
|
|
5
|
+
const hasBody = (_fetchRes.body || _fetchRes._bodyInit) && !nullBodyResponses.has(_fetchRes.status);
|
|
6
6
|
if (hasBody) {
|
|
7
7
|
const responseType = detectResponseType(_fetchRes);
|
|
8
8
|
_fetchRes._data = await _fetchRes[responseType]();
|
|
@@ -19,7 +19,11 @@ var bodyLimit = (options) => {
|
|
|
19
19
|
if (!c.req.raw.body) {
|
|
20
20
|
return next();
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
const hasTransferEncoding = c.req.raw.headers.has("transfer-encoding");
|
|
23
|
+
const hasContentLength = c.req.raw.headers.has("content-length");
|
|
24
|
+
if (hasTransferEncoding && hasContentLength) {
|
|
25
|
+
}
|
|
26
|
+
if (hasContentLength && !hasTransferEncoding) {
|
|
23
27
|
const contentLength = parseInt(c.req.raw.headers.get("content-length") || "0", 10);
|
|
24
28
|
return contentLength > maxSize ? onError(c) : next();
|
|
25
29
|
}
|