fix read on close

This commit is contained in:
holooooo
2021-05-25 15:15:43 +08:00
parent 2182081831
commit f8df3d1bee
3 changed files with 15 additions and 20 deletions

View File

@@ -662,13 +662,7 @@ func (b *BeegoHTTPRequest) ToValue(value interface{}) error {
return nil
}
resp, err := b.Response()
if err != nil {
return err
}
defer resp.Body.Close()
contentType := strings.Split(resp.Header.Get(contentTypeKey), ";")[0]
contentType := strings.Split(b.resp.Header.Get(contentTypeKey), ";")[0]
// try to parse it as content type
switch contentType {
case "application/json":