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 /services/httpservice/httpservice.go | |
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 'services/httpservice/httpservice.go')
-rw-r--r-- | services/httpservice/httpservice.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/services/httpservice/httpservice.go b/services/httpservice/httpservice.go index 5ed42a12d..6e776890f 100644 --- a/services/httpservice/httpservice.go +++ b/services/httpservice/httpservice.go @@ -5,7 +5,6 @@ package httpservice import ( "net" - "net/http" "strings" "github.com/mattermost/mattermost-server/services/configservice" @@ -13,7 +12,7 @@ import ( // Wraps the functionality for creating a new http.Client to encapsulate that and allow it to be mocked when testing type HTTPService interface { - MakeClient(trustURLs bool) *http.Client + MakeClient(trustURLs bool) *Client Close() } @@ -25,7 +24,7 @@ func MakeHTTPService(configService configservice.ConfigService) HTTPService { return &HTTPServiceImpl{configService} } -func (h *HTTPServiceImpl) MakeClient(trustURLs bool) *http.Client { +func (h *HTTPServiceImpl) MakeClient(trustURLs bool) *Client { insecure := h.configService.Config().ServiceSettings.EnableInsecureOutgoingConnections != nil && *h.configService.Config().ServiceSettings.EnableInsecureOutgoingConnections if trustURLs { |