-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Currently, the hono request output format is as follows:
{
"status": 200,
"body": "content"
"headers": {}
}We have room for reconsideration and improvement.
One problem is that if the application returns JSON, the result is like this:
The app:
import { Hono } from 'hono.'
const app = new Hono()
app.get('/', (c) => {
return c.json({
message: 'Hello'
})
})
export default appThe output:
{
"status": 200,
"body": "{\"message\":\"Hello\"}",
"headers": {
"content-type": "application/json"
}
}The body {\"message\":\"Hello\"} is expected format?? I think no. It should not be escaped. And more! Should status and headers be included in the output? Following curl, the output should be only the body content by default:
curl http://localhost:7070
{"message": "Hello"}Perhaps following curl is okay, adding an option like -I. On the other hand, JSON is beneficial to parse with jq or a simpler command. But regarding this, it's okay to add the option like --json or (-w '%{json}' looks interesting but verbose).
Anyway, we have to consider the output format of hono request.
ysknsid25
Metadata
Metadata
Assignees
Labels
No labels