diff options
author | Andreas Linz <klingt.net@gmail.com> | 2018-10-03 19:28:44 +0200 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2018-10-03 10:28:44 -0700 |
commit | cf9b9802a8732424b6cb7c233e3bfcf8cb3530ee (patch) | |
tree | 8be964e5c5c8e057dce58b09706ecd93994d790e /utils/testutils | |
parent | 580b546862860ca389305d0d4614471095ec67fe (diff) | |
download | chat-cf9b9802a8732424b6cb7c233e3bfcf8cb3530ee.tar.gz chat-cf9b9802a8732424b6cb7c233e3bfcf8cb3530ee.tar.bz2 chat-cf9b9802a8732424b6cb7c233e3bfcf8cb3530ee.zip |
Set a proper HTTP user-agent header (#9482)
Previously, mattermost-server would always request with the default
user-agent of Go's net/http package that is `Go-http-client/1.1` or
something similar.
This has several disadvantages, one is that the default user-agent
made it pretty hard to distinguish mattermost requests from other
service requests in a network log for example.
Now a user-agent of the form `mattermost-<current-version>` is set in
the client.
- [x] Added or updated unit tests (required for all new features)
Diffstat (limited to 'utils/testutils')
-rw-r--r-- | utils/testutils/mocked_http_service.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/utils/testutils/mocked_http_service.go b/utils/testutils/mocked_http_service.go index b1e7f6963..8f9bc42be 100644 --- a/utils/testutils/mocked_http_service.go +++ b/utils/testutils/mocked_http_service.go @@ -4,6 +4,7 @@ package testutils import ( + "github.com/mattermost/mattermost-server/services/httpservice" "net/http" "net/http/httptest" ) @@ -18,8 +19,8 @@ func MakeMockedHTTPService(handler http.Handler) *MockedHTTPService { } } -func (h *MockedHTTPService) MakeClient(trustURLs bool) *http.Client { - return h.Server.Client() +func (h *MockedHTTPService) MakeClient(trustURLs bool) *httpservice.Client { + return &httpservice.Client{Client: h.Server.Client()} } func (h *MockedHTTPService) Close() { |