MM-10417 Improve HTTPService for use in image proxy (#9966)

* Replaced httpservice with proper http.Client

* Added HTTPService.MakeTransport

* Expose timeouts used by HTTPServiceImpl

* Add additional documentation to HTTPService

* Remove MockedHTTPService

* Fix missing license
Этот коммит содержится в:
Harrison Healey
2018-12-12 11:39:14 -05:00
коммит произвёл GitHub
родитель f42c00ee53
Коммит 749a3e7538
9 изменённых файлов: 60 добавлений и 151 удалений

Просмотреть файл

@@ -1,30 +0,0 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package testutils
import (
"net/http"
"net/http/httptest"
"github.com/mattermost/mattermost-server/services/httpservice"
)
type MockedHTTPService struct {
Server *httptest.Server
}
func MakeMockedHTTPService(handler http.Handler) *MockedHTTPService {
return &MockedHTTPService{
Server: httptest.NewServer(handler),
}
}
func (h *MockedHTTPService) MakeClient(trustURLs bool) *httpservice.Client {
return &httpservice.Client{Client: h.Server.Client()}
}
func (h *MockedHTTPService) Close() {
h.Server.CloseClientConnections()
h.Server.Close()
}