Remove some unnecessary code
Showing
1 changed file
with
3 additions
and
12 deletions
| ... | @@ -395,10 +395,7 @@ func (b *BeegoHttpRequest) ToFile(filename string) error { | ... | @@ -395,10 +395,7 @@ func (b *BeegoHttpRequest) ToFile(filename string) error { |
| 395 | } | 395 | } |
| 396 | defer resp.Body.Close() | 396 | defer resp.Body.Close() |
| 397 | _, err = io.Copy(f, resp.Body) | 397 | _, err = io.Copy(f, resp.Body) |
| 398 | if err != nil { | 398 | return err |
| 399 | return err | ||
| 400 | } | ||
| 401 | return nil | ||
| 402 | } | 399 | } |
| 403 | 400 | ||
| 404 | // ToJson returns the map that marshals from the body bytes as json in response . | 401 | // ToJson returns the map that marshals from the body bytes as json in response . |
| ... | @@ -409,10 +406,7 @@ func (b *BeegoHttpRequest) ToJson(v interface{}) error { | ... | @@ -409,10 +406,7 @@ func (b *BeegoHttpRequest) ToJson(v interface{}) error { |
| 409 | return err | 406 | return err |
| 410 | } | 407 | } |
| 411 | err = json.Unmarshal(data, v) | 408 | err = json.Unmarshal(data, v) |
| 412 | if err != nil { | 409 | return err |
| 413 | return err | ||
| 414 | } | ||
| 415 | return nil | ||
| 416 | } | 410 | } |
| 417 | 411 | ||
| 418 | // ToXml returns the map that marshals from the body bytes as xml in response . | 412 | // ToXml returns the map that marshals from the body bytes as xml in response . |
| ... | @@ -423,10 +417,7 @@ func (b *BeegoHttpRequest) ToXML(v interface{}) error { | ... | @@ -423,10 +417,7 @@ func (b *BeegoHttpRequest) ToXML(v interface{}) error { |
| 423 | return err | 417 | return err |
| 424 | } | 418 | } |
| 425 | err = xml.Unmarshal(data, v) | 419 | err = xml.Unmarshal(data, v) |
| 426 | if err != nil { | 420 | return err |
| 427 | return err | ||
| 428 | } | ||
| 429 | return nil | ||
| 430 | } | 421 | } |
| 431 | 422 | ||
| 432 | // Response executes request client gets response mannually. | 423 | // Response executes request client gets response mannually. | ... | ... |
-
Please register or sign in to post a comment