Skip to content

[azopenai] EventReader should return an error if the stream is closed #21321

Closed
@richardpark-msft

Description

@richardpark-msft

In normal circumstances, the Body reader for EventReader returns a done: token which tells us there's no more information in the stream. We then know to return an io.EOF, which is the signal to the user that they can stop and that everything worked the way it was supposed to.

If the response body is closed prematurely, however, then we don't return io.EOF (bufio.Scanner.Next() will return false, but bufio.Scanner.Err() is purposefully nil). We should check that and return an error indicating the stream was ended prematurely so the user doesn't end up in an infinite loop and also knows that something incorrect happened (body EOF'd or was closed before they actually completed streaming).

Metadata

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.OpenAIStorageStorage Service (Queues, Blobs, Files)needs-team-triageWorkflow: This issue needs the team to triage.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions