Do not atempt to set nil user agents.

This commit is contained in:
A. Svensson 2015-11-30 19:32:32 +01:00
parent fb6cebc8dc
commit 6abeb2c101
1 changed files with 3 additions and 1 deletions

View File

@ -202,7 +202,9 @@ func (this *Document) LoadUriClient(uri string, client *http.Client, charset Cha
if err != nil {
log.Fatalln(err) // TODO
}
req.Header.Set("User-Agent", this.useragent)
if len(this.useragent) > 1 {
req.Header.Set("User-Agent", this.useragent)
}
if r, err = client.Do(req); err != nil {
return