fix: deprecated json response method (#488)

* fix deprecated json response method

* apply changesets
pull/489/head
t.kasuo 2024-04-30 20:32:15 +09:00 committed by GitHub
parent 4194ac691a
commit 1cc5e0a5b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 4 deletions

View File

@ -0,0 +1,7 @@
---
'@hono/swagger-ui': patch
'@hono/typebox-validator': patch
'@hono/typia-validator': patch
---
Fixed a part of deprecated response json method in hono since v4.

View File

@ -91,7 +91,7 @@ app.openapi(
} }
}), }),
(c) => { (c) => {
return c.jsonT({ return c.json({
message: 'hello' message: 'hello'
}) })
} }

View File

@ -16,7 +16,7 @@ describe('Basic', () => {
const route = app.post('/author', tbValidator('json', schema), (c) => { const route = app.post('/author', tbValidator('json', schema), (c) => {
const data = c.req.valid('json') const data = c.req.valid('json')
return c.jsonT({ return c.json({
success: true, success: true,
message: `${data.name} is ${data.age}`, message: `${data.name} is ${data.age}`,
}) })

View File

@ -17,7 +17,7 @@ interface Author {
const route = app.post('/author', typiaValidator('json', validate), (c) => { const route = app.post('/author', typiaValidator('json', validate), (c) => {
const data = c.req.valid('json') const data = c.req.valid('json')
return c.jsonT({ return c.json({
success: true, success: true,
message: `${data.name} is ${data.age}`, message: `${data.name} is ${data.age}`,
}) })

View File

@ -19,7 +19,7 @@ describe('Basic', () => {
const route = app.post('/author', typiaValidator('json', validate), (c) => { const route = app.post('/author', typiaValidator('json', validate), (c) => {
const data = c.req.valid('json') const data = c.req.valid('json')
return c.jsonT({ return c.json({
success: true, success: true,
message: `${data.name} is ${data.age}`, message: `${data.name} is ${data.age}`,
}) })