mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 19:20:54 +00:00
Merge pull request #748 from smallfish/master
Remove some unnecessary code
This commit is contained in:
commit
8b8638c507
@ -394,10 +394,7 @@ func (b *BeegoHttpRequest) ToFile(filename string) error {
|
|||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
_, err = io.Copy(f, resp.Body)
|
_, err = io.Copy(f, resp.Body)
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToJson returns the map that marshals from the body bytes as json in response .
|
// ToJson returns the map that marshals from the body bytes as json in response .
|
||||||
@ -408,10 +405,7 @@ func (b *BeegoHttpRequest) ToJson(v interface{}) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = json.Unmarshal(data, v)
|
err = json.Unmarshal(data, v)
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToXml returns the map that marshals from the body bytes as xml in response .
|
// ToXml returns the map that marshals from the body bytes as xml in response .
|
||||||
@ -422,10 +416,7 @@ func (b *BeegoHttpRequest) ToXML(v interface{}) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = xml.Unmarshal(data, v)
|
err = xml.Unmarshal(data, v)
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response executes request client gets response mannually.
|
// Response executes request client gets response mannually.
|
||||||
|
Loading…
Reference in New Issue
Block a user