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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f42c00ee53
Коммит
749a3e7538
@@ -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()
|
||||
}
|
||||
Ссылка в новой задаче
Block a user