fix(zod-validator): convert `TypedResponse` to `Response` in hook (#116)
* fix(zod-validator): convert `TypedResponse` to `Response` in hook * changesetpull/117/head
parent
a5a0692c3a
commit
c271b6d502
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@hono/zod-validator': patch
|
||||
---
|
||||
|
||||
fix(zod-validator): convert TypedResponse to Response in hook
|
|
@ -36,13 +36,13 @@ export const zValidator = <
|
|||
|
||||
if (hook) {
|
||||
const hookResult = hook({ data: value, ...result }, c)
|
||||
if (
|
||||
hookResult &&
|
||||
(hookResult instanceof Response ||
|
||||
hookResult instanceof Promise ||
|
||||
'response' in hookResult)
|
||||
) {
|
||||
return hookResult
|
||||
if (hookResult) {
|
||||
if (hookResult instanceof Response || hookResult instanceof Promise) {
|
||||
return hookResult
|
||||
}
|
||||
if ('response' in hookResult) {
|
||||
return hookResult.response
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue