httplib: fix the header function for User-Agent

This commit is contained in:
astaxie
2014-09-05 23:21:41 +08:00
parent f7cd1479ba
commit 647a47517d
2 changed files with 11 additions and 1 deletions

View File

@@ -355,7 +355,7 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) {
Jar: jar,
}
if b.setting.UserAgent != "" {
if b.setting.UserAgent != "" && b.req.Header.Get("User-Agent") == "" {
b.req.Header.Set("User-Agent", b.setting.UserAgent)
}