hono 4.4.5 → 4.4.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,9 +25,19 @@ var streamHandle = (app) => {
25
25
  requestContext,
26
26
  context
27
27
  });
28
+ const headers = {};
29
+ const cookies = [];
30
+ res.headers.forEach((value, name) => {
31
+ if (name === "set-cookie") {
32
+ cookies.push(value);
33
+ } else {
34
+ headers[name] = value;
35
+ }
36
+ });
28
37
  const httpResponseMetadata = {
29
38
  statusCode: res.status,
30
- headers: Object.fromEntries(res.headers.entries())
39
+ headers,
40
+ cookies
31
41
  };
32
42
  responseStream = awslambda.HttpResponseStream.from(responseStream, httpResponseMetadata);
33
43
  if (res.body) {
@@ -57,9 +57,19 @@ const streamHandle = (app) => {
57
57
  requestContext,
58
58
  context
59
59
  });
60
+ const headers = {};
61
+ const cookies = [];
62
+ res.headers.forEach((value, name) => {
63
+ if (name === "set-cookie") {
64
+ cookies.push(value);
65
+ } else {
66
+ headers[name] = value;
67
+ }
68
+ });
60
69
  const httpResponseMetadata = {
61
70
  statusCode: res.status,
62
- headers: Object.fromEntries(res.headers.entries())
71
+ headers,
72
+ cookies
63
73
  };
64
74
  responseStream = awslambda.HttpResponseStream.from(responseStream, httpResponseMetadata);
65
75
  if (res.body) {
@@ -57,8 +57,8 @@ export type Layout<T = Record<string, any>> = (props: T) => any;
57
57
  * @template E - Environment type.
58
58
  */
59
59
  interface Get<E extends Env> {
60
- <Key extends keyof ContextVariableMap>(key: Key): ContextVariableMap[Key];
61
60
  <Key extends keyof E['Variables']>(key: Key): E['Variables'][Key];
61
+ <Key extends keyof ContextVariableMap>(key: Key): ContextVariableMap[Key];
62
62
  }
63
63
  /**
64
64
  * Interface for setting context variables.
@@ -66,8 +66,8 @@ interface Get<E extends Env> {
66
66
  * @template E - Environment type.
67
67
  */
68
68
  interface Set<E extends Env> {
69
- <Key extends keyof ContextVariableMap>(key: Key, value: ContextVariableMap[Key]): void;
70
69
  <Key extends keyof E['Variables']>(key: Key, value: E['Variables'][Key]): void;
70
+ <Key extends keyof ContextVariableMap>(key: Key, value: ContextVariableMap[Key]): void;
71
71
  }
72
72
  /**
73
73
  * Interface for creating a new response.
@@ -133,8 +133,8 @@ type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown>, U exten
133
133
  * @returns A Response object or a Promise that resolves to a Response object.
134
134
  */
135
135
  interface HTMLRespond {
136
- (html: string | Promise<string>, status?: StatusCode, headers?: HeaderRecord): Response | Promise<Response>;
137
- (html: string | Promise<string>, init?: ResponseInit): Response | Promise<Response>;
136
+ <T extends string | Promise<string>>(html: T, status?: StatusCode, headers?: HeaderRecord): T extends string ? Response : Promise<Response>;
137
+ <T extends string | Promise<string>>(html: T, init?: ResponseInit): T extends string ? Response : Promise<Response>;
138
138
  }
139
139
  /**
140
140
  * Options for configuring the context.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.4.5",
3
+ "version": "4.4.7",
4
4
  "description": "Ultrafast web framework for the Edges",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",