Skip to content

empty request body with Deno #2819

@joaofnds

Description

@joaofnds

Please avoid duplicates

Reproducible test case

import nock from "npm:[email protected]";

nock("http://example.com")
  .get("/")
  .reply(200, "Hello World!");

const response = await fetch("http://example.com");
console.log({ body: await response.text() });
$ deno install --entrypoint main.js
$ deno --allow-env main.js
{ body: "" }

Nock Version

14.0.1

Node Version

$ deno --version
deno 2.1.9 (stable, release, aarch64-apple-darwin)
v8 13.0.245.12-rusty
typescript 5.6.2

TypeScript Version

Not using typescript.

What happened?

When using Nock with Deno, the response body is empty despite the mocked response specifying a body.

This issue seems specific to using Nock with Deno. The same code works as expected in a Node.js environment.

Would you be interested in contributing a fix?

  • yes

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