Scope
new Request(url, { body }).text() / .json() / .arrayBuffer() return 0 instead of the request body under Perry-native compile. req.method / req.url / req.headers work (#1649); only the body-consuming methods are unimplemented.
This blocks the Hono app.post('/api/echo', async c => c.json({ body: await c.req.json() })) route in the #1655 acceptance — c.req.json() reads the request body via req.text()/the body stream.
Repro (Perry @ main 7371549)
const req = new Request('http://localhost/x', {
method: 'POST', headers: { 'content-type': 'application/json' }, body: '{"x":1}',
})
console.log('method', req.method) // POST ✅
console.log('text', await req.text()) // 0 ❌ (expected '{"x":1}')
console.log('json', JSON.stringify(await req.json())) // 0 ❌ (expected {"x":1})
Observed: text and json both yield 0.
Expected (Node): {"x":1} / {"x":1}.
Note
js_request_get_body already stores the body string (used by the req.body property getter); the gap is that Request.text() / .json() / .arrayBuffer() aren't wired to it (the typed module=="Request" codegen arm in lower_call/options/fetch.rs handles url/method/body/headers properties but no body methods, and there's no untyped dispatch_request_method). Mirror the existing Response .text()/.json() path.
Related
Scope
new Request(url, { body }).text()/.json()/.arrayBuffer()return0instead of the request body under Perry-native compile.req.method/req.url/req.headerswork (#1649); only the body-consuming methods are unimplemented.This blocks the Hono
app.post('/api/echo', async c => c.json({ body: await c.req.json() }))route in the #1655 acceptance —c.req.json()reads the request body viareq.text()/the body stream.Repro (Perry @ main 7371549)
Observed:
textandjsonboth yield0.Expected (Node):
{"x":1}/{"x":1}.Note
js_request_get_bodyalready stores the body string (used by thereq.bodyproperty getter); the gap is thatRequest.text()/.json()/.arrayBuffer()aren't wired to it (the typedmodule=="Request"codegen arm inlower_call/options/fetch.rshandlesurl/method/body/headersproperties but no body methods, and there's no untypeddispatch_request_method). Mirror the existingResponse.text()/.json()path.Related
/api/echoline.