hono 3.12.2 → 3.12.3
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/adapter/lambda-edge/handler.js +2 -1
- package/dist/cjs/adapter/lambda-edge/handler.js +2 -1
- package/dist/cjs/context.js +11 -3
- package/dist/cjs/router/linear-router/router.js +5 -6
- package/dist/cjs/router/reg-exp-router/router.js +1 -4
- package/dist/context.js +11 -3
- package/dist/router/linear-router/router.js +5 -6
- package/dist/router/reg-exp-router/router.js +1 -4
- package/dist/types/client/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/context.js
CHANGED
|
@@ -241,9 +241,17 @@ class Context {
|
|
|
241
241
|
__privateSet(this, _isFresh, false);
|
|
242
242
|
if (__privateGet(this, _res) && _res2) {
|
|
243
243
|
__privateGet(this, _res).headers.delete("content-type");
|
|
244
|
-
__privateGet(this, _res).headers.
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
for (const [k, v] of __privateGet(this, _res).headers.entries()) {
|
|
245
|
+
if (k === "set-cookie") {
|
|
246
|
+
const cookies = __privateGet(this, _res).headers.getSetCookie();
|
|
247
|
+
_res2.headers.delete("set-cookie");
|
|
248
|
+
for (const cookie of cookies) {
|
|
249
|
+
_res2.headers.append("set-cookie", cookie);
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
_res2.headers.set(k, v);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
247
255
|
}
|
|
248
256
|
__privateSet(this, _res, _res2);
|
|
249
257
|
this.finalized = true;
|
|
@@ -22,6 +22,7 @@ __export(router_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(router_exports);
|
|
24
24
|
var import_router = require("../../router");
|
|
25
|
+
var import_url = require("../../utils/url");
|
|
25
26
|
const emptyParams = {};
|
|
26
27
|
const splitPathRe = /\/(:\w+(?:{[^}]+})?)|\/[^\/\?]+|(\?)/g;
|
|
27
28
|
const splitByStarRe = /\*/;
|
|
@@ -31,12 +32,10 @@ class LinearRouter {
|
|
|
31
32
|
this.routes = [];
|
|
32
33
|
}
|
|
33
34
|
add(method, path, handler) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.routes.push([method,
|
|
37
|
-
}
|
|
38
|
-
this.routes.push([method, path, handler]);
|
|
39
|
-
}
|
|
35
|
+
;
|
|
36
|
+
((0, import_url.checkOptionalParameter)(path) || [path]).forEach((p) => {
|
|
37
|
+
this.routes.push([method, p, handler]);
|
|
38
|
+
});
|
|
40
39
|
}
|
|
41
40
|
match(method, path) {
|
|
42
41
|
const handlers = [];
|
|
@@ -167,10 +167,7 @@ class RegExpRouter {
|
|
|
167
167
|
(_a2 = routes[m])[path2] || (_a2[path2] = [
|
|
168
168
|
...findMiddleware(middleware[m], path2) || findMiddleware(middleware[import_router.METHOD_NAME_ALL], path2) || []
|
|
169
169
|
]);
|
|
170
|
-
routes[m][path2].push([
|
|
171
|
-
handler,
|
|
172
|
-
paths.length === 2 && i === 0 ? paramCount - 1 : paramCount
|
|
173
|
-
]);
|
|
170
|
+
routes[m][path2].push([handler, paramCount - len + i + 1]);
|
|
174
171
|
}
|
|
175
172
|
});
|
|
176
173
|
}
|
package/dist/context.js
CHANGED
|
@@ -219,9 +219,17 @@ var Context = class {
|
|
|
219
219
|
__privateSet(this, _isFresh, false);
|
|
220
220
|
if (__privateGet(this, _res) && _res2) {
|
|
221
221
|
__privateGet(this, _res).headers.delete("content-type");
|
|
222
|
-
__privateGet(this, _res).headers.
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
for (const [k, v] of __privateGet(this, _res).headers.entries()) {
|
|
223
|
+
if (k === "set-cookie") {
|
|
224
|
+
const cookies = __privateGet(this, _res).headers.getSetCookie();
|
|
225
|
+
_res2.headers.delete("set-cookie");
|
|
226
|
+
for (const cookie of cookies) {
|
|
227
|
+
_res2.headers.append("set-cookie", cookie);
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
230
|
+
_res2.headers.set(k, v);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
225
233
|
}
|
|
226
234
|
__privateSet(this, _res, _res2);
|
|
227
235
|
this.finalized = true;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/router/linear-router/router.ts
|
|
2
2
|
import { METHOD_NAME_ALL, UnsupportedPathError } from "../../router.js";
|
|
3
|
+
import { checkOptionalParameter } from "../../utils/url.js";
|
|
3
4
|
var emptyParams = {};
|
|
4
5
|
var splitPathRe = /\/(:\w+(?:{[^}]+})?)|\/[^\/\?]+|(\?)/g;
|
|
5
6
|
var splitByStarRe = /\*/;
|
|
@@ -9,12 +10,10 @@ var LinearRouter = class {
|
|
|
9
10
|
this.routes = [];
|
|
10
11
|
}
|
|
11
12
|
add(method, path, handler) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.routes.push([method,
|
|
15
|
-
}
|
|
16
|
-
this.routes.push([method, path, handler]);
|
|
17
|
-
}
|
|
13
|
+
;
|
|
14
|
+
(checkOptionalParameter(path) || [path]).forEach((p) => {
|
|
15
|
+
this.routes.push([method, p, handler]);
|
|
16
|
+
});
|
|
18
17
|
}
|
|
19
18
|
match(method, path) {
|
|
20
19
|
const handlers = [];
|
|
@@ -150,10 +150,7 @@ var RegExpRouter = class {
|
|
|
150
150
|
(_a2 = routes[m])[path2] || (_a2[path2] = [
|
|
151
151
|
...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []
|
|
152
152
|
]);
|
|
153
|
-
routes[m][path2].push([
|
|
154
|
-
handler,
|
|
155
|
-
paths.length === 2 && i === 0 ? paramCount - 1 : paramCount
|
|
156
|
-
]);
|
|
153
|
+
routes[m][path2].push([handler, paramCount - len + i + 1]);
|
|
157
154
|
}
|
|
158
155
|
});
|
|
159
156
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { hc } from './client';
|
|
2
|
-
export type { InferResponseType, InferRequestType, Fetch, ClientRequestOptions } from './types';
|
|
2
|
+
export type { InferResponseType, InferRequestType, Fetch, ClientRequestOptions, ClientRequest, ClientResponse, } from './types';
|