Skip to content

Some requests are slow for non-standard event-stream responses. #4712

@zly2006

Description

@zly2006

Bug Description

A standard text/event-stream response has a space after the colon (event: ), but some server APIs do not implement it correctly, they dont have the space, and undici cannot resolve the fetch call until all response are sent back. This makes some AI & RAG chat very slow and user unfriendly.

Reproducible By

I am sorry this request requires some credentials, I am going to update a python or rust example server soon.

Expected Behavior

Resolve the fetch call after all headers are received. Do not wait for full response.

Logs & Screenshots

n/a

Environment

Node.js v25.2.1
MacOS 15.7.3

Additional context

I am trying to work on this issue, this is my first time trying to contribute to undici. I will maybe ask some dumb questions and try to submit a PR, thank you!

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