Skip to content

Empty c.req.raw body for application/x-www-form-urlencoded #2695

Closed
@LuisMalhadas

Description

@LuisMalhadas

What version of Hono are you using?

4.3.6

What runtime/platform is your app running on?

bun 1.1.8

What steps can reproduce the bug?

import { HTTPException } from 'hono/http-exception'
import { OpenAPIHono } from '@hono/zod-openapi'

const app = new OpenAPIHono()

app.use(async (c, next) => {
  console.log('Request received:: \n',c.req.raw)
  const bod = await c.req.parseBody()
  console.log('After parse:: ',bod)
  await next()
})

export default {
  port: 4000,
  fetch: app.fetch,
}

What is the expected behavior?

{
  accept: "*/*",
  "accept-encoding": "deflate, gzip, br",
  authorization: "-------",
  "content-length": "125073",
  "content-type": "application/x-www-form-urlencoded",
  host: "api-service:4000",
  "user-agent": "MoodleBot/4.3 (+http://localhost:8080)",
  client_id: "nkalnw0ov",
}
�ftypM4A M4A isommp42�mdat�� ...

What do you see instead?

Request (0 KB) {
method: "POST",
url: "http://api-service:4000/endpoint",
headers: Headers {
    "host": "api-service:4000",
     "accept": "*/*",
     "accept-encoding": "deflate, gzip, br",
     "authorization": "------",
     "user-agent": "MoodleBot/4.3 (+http://localhost:8080)",
     "content-length": "125073",
     "content-type": "application/x-www-form-urlencoded",
   }
}
{}

Additional information

I can get the body using plain bun.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions