Skip to content

[node] stream doesn't get sent if response is cloned #1278

@huseeiin

Description

@huseeiin

Environment

node 24.12.0
h3 2.0.1-rc.7

Reproduction

import { H3, onResponse, serve } from "h3";

const app = new H3();

app.use(
    onResponse((response, event) => {
        // this is the line that breaks it:
        response.clone();
    }),
);

app.use((e, n) => {
    const a: {
        pipe: (writable: {
            write: (v: string) => void;
            end(): void;
        }) => void;
    } = {
        pipe(writable) {
            writable.write("test");
            writable.end();
        },
    };
    return a;
});

serve(app);

Describe the bug

is this intentional behavior?

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions