add returned error for ghttp.ClientResponse.Close

This commit is contained in:
John 2019-06-16 18:54:48 +08:00
parent ebdad47f2d
commit 4ffe4f2262
2 changed files with 10 additions and 8 deletions

View File

@ -3,7 +3,6 @@
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
// HTTP客户端请求返回.
package ghttp
@ -48,7 +47,7 @@ func (r *ClientResponse) ReadAllString() string {
}
// 关闭返回的HTTP链接
func (r *ClientResponse) Close() {
func (r *ClientResponse) Close() error {
r.Response.Close = true
r.Body.Close()
return r.Body.Close()
}

View File

@ -6,9 +6,12 @@ import (
)
func main() {
q1 := gqueue.New(2)
q1.Push(1)
q1.Push(2)
gtest.Assert(q1.Size(),2)
max := 100
for i := 0; i < 10; i++ {
q := gqueue.New(max)
for i := 1; i < max; i++ {
q.Push(i)
}
gtest.Assert(q.Pop(), 1)
}
}