Closed
Description
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).