// Just keep printing up the lines from the response, until the user closes it
Just keep printing up the lines from the response, until the user closes it
// Just keep printing up the lines from the response until the user closes it
func DisplayStream(response *Response) {
	defer response.Reader.Close()
	reader := bufio.NewReader(response.Reader)
	for {
		if StopStreaming {
			return
		}
		data, err := reader.ReadBytes('\n')
		if err != nil {
			if err == io.EOF {
				return
			} else if err == io.ErrUnexpectedEOF {
				fmt.Printf("%s", data)
				return
			} else {
				log.Fatal("ReadBytes", err)
			}
		}
		fmt.Printf("%s", data)
	}
	fmt.Println("Done Reading Buffer")
}
func DisplayStream ( response * Response ) { defer response . Reader . Close ( ) reader := bufio . NewReader ( response . Reader ) for { if StopStreaming { return } data , err := reader . ReadBytes ( '\n' ) if err != nil { if err == io . EOF { return } else if err == io . ErrUnexpectedEOF { fmt . Printf ( " " , data ) return } else { log . Fatal ( " " , err ) } } fmt . Printf ( " " , data ) } fmt . Println ( " " ) }
Just keep printing up the lines from the response, until the user closes it
Just keep printing up the lines from the response until the user closes it
// Interrupt read