Skip to content

Commit db7de2f

Browse files
committedMay 13, 2024
feat(hono): add async to handler
1 parent 393a6d8 commit db7de2f

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed
 

‎packages/hono/src/index.ts

+9-12
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ ${
142142
!!verbOption.response.originalSchema?.['200']?.content?.['application/json']
143143
? `zValidator('response', ${verbOption.operationName}Response),\n`
144144
: ''
145-
}(c: ${contextTypeName}) => {
145+
}async (c: ${contextTypeName}) => {
146146
147147
},
148148
);`;
@@ -199,17 +199,14 @@ const getHandlerFix = ({
199199
const getVerbOptionGroupByTag = (
200200
verbOptions: Record<string, GeneratorVerbOptions>,
201201
) => {
202-
return Object.values(verbOptions).reduce(
203-
(acc, value) => {
204-
const tag = value.tags[0];
205-
if (!acc[tag]) {
206-
acc[tag] = [];
207-
}
208-
acc[tag].push(value);
209-
return acc;
210-
},
211-
{} as Record<string, GeneratorVerbOptions[]>,
212-
);
202+
return Object.values(verbOptions).reduce((acc, value) => {
203+
const tag = value.tags[0];
204+
if (!acc[tag]) {
205+
acc[tag] = [];
206+
}
207+
acc[tag].push(value);
208+
return acc;
209+
}, {} as Record<string, GeneratorVerbOptions[]>);
213210
};
214211

215212
const generateHandlers = async (

0 commit comments

Comments
 (0)
Please sign in to comment.