Skip to content

Commit

Permalink
refactor streamReader
Browse files Browse the repository at this point in the history
  • Loading branch information
liushuangls committed Oct 10, 2023
1 parent 54c904d commit 1b9af61
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,14 @@ func sendRequestStream[T streamable](client *Client, req *http.Request) (*stream
if isFailureStatusCode(resp) {
return new(streamReader[T]), client.handleErrorResp(resp)
}
reader := &streamReader[T]{
return &streamReader[T]{
emptyMessagesLimit: client.config.EmptyMessagesLimit,
reader: bufio.NewReader(resp.Body),
response: resp,
errAccumulator: utils.NewErrorAccumulator(),
unmarshaler: &utils.JSONUnmarshaler{},
}
reader.SetHeader(resp.Header)
return reader, nil
httpHeader: httpHeader(resp.Header),
}, nil
}

func (c *Client) setCommonHeaders(req *http.Request) {
Expand Down

0 comments on commit 1b9af61

Please sign in to comment.