aboutsummaryrefslogtreecommitdiff
path: root/internal/httplib/httplib.go
diff options
context:
space:
mode:
authordeepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>2022-03-06 16:33:45 +0800
committerGitHub <noreply@github.com>2022-03-06 16:33:45 +0800
commitdeec3516d53e9a9679128ade0556ccc818a67be1 (patch)
treeb5c1c5d55be05a244180ece0b822e7e35dc68f42 /internal/httplib/httplib.go
parent65526f84e1d382ac01b7379f40fc56b2660d1074 (diff)
autofix: fix check for empty string (#6804)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/httplib/httplib.go')
-rw-r--r--internal/httplib/httplib.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/httplib/httplib.go b/internal/httplib/httplib.go
index 142eb7c5..f1b35eb3 100644
--- a/internal/httplib/httplib.go
+++ b/internal/httplib/httplib.go
@@ -169,7 +169,7 @@ func (r *Request) Headers() http.Header {
// Set the protocol version for incoming requests.
// Client requests always use HTTP/1.1.
func (r *Request) SetProtocolVersion(vers string) *Request {
- if len(vers) == 0 {
+ if vers == "" {
vers = "HTTP/1.1"
}
@@ -339,7 +339,7 @@ func (r *Request) getResponse() (*http.Response, error) {
Jar: jar,
}
- if len(r.setting.UserAgent) > 0 && len(r.req.Header.Get("User-Agent")) == 0 {
+ if len(r.setting.UserAgent) > 0 && r.req.Header.Get("User-Agent") == "" {
r.req.Header.Set("User-Agent", r.setting.UserAgent)
}