Skip to content

Conversation

@ysknsid25
Copy link
Contributor

@ysknsid25 ysknsid25 commented Dec 6, 2025

resolves: #51

  • Pretty Format
  • -o <path> and -O
  • -J and --json
  • -i and -I

Sample

app.ts

import { Hono } from 'hono'
import { readFile } from 'node:fs/promises'
import { join } from 'node:path'

const app = new Hono()

app.get('/image.png', async (c) => {
  try {
    const imagePath = join(process.cwd(), 'src', 'image.png')
    const imageData = await readFile(imagePath)
    return c.body(imageData.buffer, 200, {
      'Content-Type': 'image/png',
    })
  } catch (error) {
    console.error('Error serving image:', error)
    return c.text('Image not found', 404)
  }
})

export default app

use this png image

image

Pretty Format

node ./dist/cli.js request ./src/app.ts

image

Pretty Format & -e

node ./dist/cli.js request ./src/app.ts -e

image

Binary Response & not save

node ./dist/cli.js request ./src/app.ts -P /image.png

image

JSON Response & -o <path>

node ./dist/cli.js request ./src/app.ts -o index.json

image

JSON Response & -O

node ./dist/cli.js request ./src/app.ts -O

image

/ is not valid file name.

Binary Response & -o <path>

node ./dist/cli.js request ./src/app.ts -P /image.png -o test.png

image

Binary Response & -O

node ./dist/cli.js request ./src/app.ts -P /image.png -O

image

-J and --json

WIP

-i and -I

WIP

fix test

Signed-off-by: ysknsid25 <[email protected]>
@ysknsid25 ysknsid25 marked this pull request as draft December 6, 2025 07:39
@ysknsid25 ysknsid25 marked this pull request as ready for review December 6, 2025 07:39
fix function name `parsedResponseBody`

Signed-off-by: ysknsid25 <[email protected]>
fix README

Signed-off-by: ysknsid25 <[email protected]>
@ysknsid25 ysknsid25 marked this pull request as draft December 6, 2025 07:48
fix output format when direct`exclude`

Signed-off-by: ysknsid25 <[email protected]>
@ysknsid25 ysknsid25 marked this pull request as ready for review December 6, 2025 11:23
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 5, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@hono/cli@58

commit: 667d7f8

Signed-off-by: ysknsid25 <[email protected]>
@ysknsid25 ysknsid25 changed the title feat(request): Improve hono request output [WIP 2/4] feat(request): Improve hono request output Jan 5, 2026
@ysknsid25 ysknsid25 changed the title [WIP 2/4] feat(request): Improve hono request output [WIP] feat(request): Improve hono request output Jan 5, 2026
@ysknsid25 ysknsid25 marked this pull request as draft January 5, 2026 13:24
@yusukebe
Copy link
Member

yusukebe commented Jan 6, 2026

Hey @ysknsid25

If it's ready to review, please ping me!

@ysknsid25
Copy link
Contributor Author

@yusukebe
A Happy New Year @yusukebe 🎍
Okey, dokey 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve hono request output

2 participants