add IsStream

This commit is contained in:
bxd
2023-11-14 09:39:34 +08:00
parent 5d8548f04e
commit 992b96e855
2 changed files with 2 additions and 2 deletions

View File

@@ -193,7 +193,7 @@ func (obj *Client) Request(ctx context.Context, method string, href string, opti
func (obj *Client) request(ctx context.Context, option *RequestOption) (response *Response, err error) {
response = new(Response)
defer func() {
if err == nil && !response.oneceAlive() {
if err == nil && !response.IsStream() {
err = response.ReadBody()
defer response.CloseBody()
}

View File

@@ -249,7 +249,7 @@ func (obj *Response) Read(con []byte) (i int, err error) {
}
}
func (obj *Response) oneceAlive() bool {
func (obj *Response) IsStream() bool {
return obj.webSocket != nil || obj.sseClient != nil || obj.stream
}