createCall's incoming request is not a readable stream

Open
#6 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
node.js, typescript
Domain
api, backend

Research direction

Start at unenv/runtime/fetch/index, where the issue imports createCall, and run the provided reproduction with a request body of 'test'. Trace how the incoming request is constructed; done means its readable state, readableLength, and content-length header match the stated Node server behavior.

Written by the indexing model from the issue text.

Description

bug
Environment

NA

Reproduction
import { createCall } from "unenv/runtime/fetch/index";

createCall(async (req, res) => {
  console.log(req.readable); // false
  console.log(req.readableLength); // 0
  console.log(req.header["content-length"]); //undefined
})({url: '/', body: 'test'})
Describe the bug

While the real node implementation of a server would have req.readable = true and readableLength = 4 as well as a content-length = 4 header

Additional context

No response

Logs

No response

Dominant language
TypeScript
Stars
17
Forks
4
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from unjs/node-mock-http

All issues in unjs/node-mock-http

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.