mirror of
https://github.com/miniflux/v2.git
synced 2025-07-02 16:38:37 +00:00
Show correct User Agent in input placeholders
This commit is contained in:
parent
e589a35c67
commit
2cf9bde1af
15 changed files with 37 additions and 64 deletions
|
@ -5,10 +5,7 @@
|
|||
package client // import "miniflux.app/http/client"
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"miniflux.app/config"
|
||||
)
|
||||
|
||||
func TestClientWithDelay(t *testing.T) {
|
||||
|
@ -54,21 +51,3 @@ func TestClientWithBasicAuth(t *testing.T) {
|
|||
t.Fatalf(`The client should be authenticated successfully: %v`, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientRequestUserAgent(t *testing.T) {
|
||||
clt := New("http://httpbin.org")
|
||||
if clt.requestUserAgent != DefaultUserAgent {
|
||||
t.Errorf(`The client had default User-Agent %q, wanted %q`, clt.requestUserAgent, DefaultUserAgent)
|
||||
}
|
||||
|
||||
userAgent := "Custom User Agent"
|
||||
os.Setenv("HTTP_CLIENT_USER_AGENT", userAgent)
|
||||
opts, err := config.NewParser().ParseEnvironmentVariables()
|
||||
if err != nil {
|
||||
t.Fatalf(`Parsing config failed: %v`, err)
|
||||
}
|
||||
clt = NewClientWithConfig("http://httpbin.org", opts)
|
||||
if clt.requestUserAgent != userAgent {
|
||||
t.Errorf(`The client had User-Agent %q, wanted %q`, clt.requestUserAgent, userAgent)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue