Skip to content

Missing '\r\n' in last boundary of FormData #4197

@viwydev

Description

@viwydev

Bug Description

When we send a POST request containing a FormData with fetch, the server never responds (as if still waiting for data). We end up going into timeout.

Reproducible By

const form = new FormData();
form.append('hash', 'abc123deadbeef');

let timer:any ;
const resp = Promise.race([
fetch('http://localhost:3000/api', {
method: 'POST',
body: form
}),
new Promise((_,rejection) => timer = setTimeout(rejection, 10000, exception))
]).finally(() => clearTimeout(timer)) ;

Expected Behavior

The last boundary should end with a new line '\r\n' allowing the server to know that all data has been sent.

Logs & Screenshots

Image

Environment

Node v22.15.0

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