Move HTTP service to public for plugin use (#27284)
* Move httpservice for use in plugins * Adapt httpservice for plugin use * Fix lint
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bff2989d95
Коммит
04181247f8
@@ -10,10 +10,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/timezones"
|
"github.com/mattermost/mattermost/server/public/shared/timezones"
|
||||||
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/imageproxy"
|
"github.com/mattermost/mattermost/server/v8/platform/services/imageproxy"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/shared/templates"
|
"github.com/mattermost/mattermost/server/v8/platform/shared/templates"
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import (
|
|||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
"github.com/mattermost/mattermost/server/public/plugin"
|
"github.com/mattermost/mattermost/server/public/plugin"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/i18n"
|
"github.com/mattermost/mattermost/server/public/shared/i18n"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/request"
|
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||||
@@ -28,7 +29,6 @@ import (
|
|||||||
"github.com/mattermost/mattermost/server/v8/channels/audit"
|
"github.com/mattermost/mattermost/server/v8/channels/audit"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||||
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/imageproxy"
|
"github.com/mattermost/mattermost/server/v8/platform/services/imageproxy"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/remotecluster"
|
"github.com/mattermost/mattermost/server/v8/platform/services/remotecluster"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import (
|
|||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
"github.com/mattermost/mattermost/server/public/plugin"
|
"github.com/mattermost/mattermost/server/public/plugin"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/i18n"
|
"github.com/mattermost/mattermost/server/public/shared/i18n"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/request"
|
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||||
@@ -29,7 +30,6 @@ import (
|
|||||||
"github.com/mattermost/mattermost/server/v8/channels/audit"
|
"github.com/mattermost/mattermost/server/v8/channels/audit"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||||
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/imageproxy"
|
"github.com/mattermost/mattermost/server/v8/platform/services/imageproxy"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/remotecluster"
|
"github.com/mattermost/mattermost/server/v8/platform/services/remotecluster"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/app/platform"
|
"github.com/mattermost/mattermost/server/v8/channels/app/platform"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/utils/testutils"
|
"github.com/mattermost/mattermost/server/v8/channels/utils/testutils"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/imageproxy"
|
"github.com/mattermost/mattermost/server/v8/platform/services/imageproxy"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import (
|
|||||||
"golang.org/x/crypto/acme/autocert"
|
"golang.org/x/crypto/acme/autocert"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/i18n"
|
"github.com/mattermost/mattermost/server/public/shared/i18n"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/request"
|
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||||
@@ -66,7 +67,6 @@ import (
|
|||||||
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/awsmeter"
|
"github.com/mattermost/mattermost/server/v8/platform/services/awsmeter"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/cache"
|
"github.com/mattermost/mattermost/server/v8/platform/services/cache"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/remotecluster"
|
"github.com/mattermost/mattermost/server/v8/platform/services/remotecluster"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine/bleveengine"
|
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine/bleveengine"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine/bleveengine/indexer"
|
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine/bleveengine/indexer"
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import (
|
|||||||
"github.com/wiggin77/merror"
|
"github.com/wiggin77/merror"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/configservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/jobs"
|
"github.com/mattermost/mattermost/server/v8/channels/jobs"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/configservice"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AppIface interface {
|
type AppIface interface {
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/configservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/request"
|
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/jobs"
|
"github.com/mattermost/mattermost/server/v8/channels/jobs"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/configservice"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AppIface interface {
|
type AppIface interface {
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import (
|
|||||||
"github.com/wiggin77/merror"
|
"github.com/wiggin77/merror"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/configservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/request"
|
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/jobs"
|
"github.com/mattermost/mattermost/server/v8/channels/jobs"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/configservice"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AppIface interface {
|
type AppIface interface {
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/configservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/request"
|
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/jobs"
|
"github.com/mattermost/mattermost/server/v8/channels/jobs"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/configservice"
|
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/shared/filestore"
|
"github.com/mattermost/mattermost/server/v8/platform/shared/filestore"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/configservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/request"
|
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/jobs"
|
"github.com/mattermost/mattermost/server/v8/channels/jobs"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/configservice"
|
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/telemetry"
|
"github.com/mattermost/mattermost/server/v8/platform/services/telemetry"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/configservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||||
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/configservice"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type JobServer struct {
|
type JobServer struct {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/configservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/configservice"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Workers struct {
|
type Workers struct {
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/utils/testutils"
|
"github.com/mattermost/mattermost/server/v8/channels/utils/testutils"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func makeTestAtmosCamoProxy() *ImageProxy {
|
func makeTestAtmosCamoProxy() *ImageProxy {
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/configservice"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/configservice"
|
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrNotEnabled = Error{errors.New("imageproxy.ImageProxy: image proxy not enabled")}
|
var ErrNotEnabled = Error{errors.New("imageproxy.ImageProxy: image proxy not enabled")}
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/utils/testutils"
|
"github.com/mattermost/mattermost/server/v8/channels/utils/testutils"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func makeTestLocalProxy() *ImageProxy {
|
func makeTestLocalProxy() *ImageProxy {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
"github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client is the programmatic interface to the marketplace server API.
|
// Client is the programmatic interface to the marketplace server API.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ package mocks
|
|||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
|
|
||||||
httpservice "github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
httpservice "github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
mock "github.com/stretchr/testify/mock"
|
mock "github.com/stretchr/testify/mock"
|
||||||
|
|
||||||
model "github.com/mattermost/mattermost/server/public/model"
|
model "github.com/mattermost/mattermost/server/public/model"
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ import (
|
|||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
"github.com/mattermost/mattermost/server/public/plugin"
|
"github.com/mattermost/mattermost/server/public/plugin"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||||
"github.com/mattermost/mattermost/server/v8/channels/utils"
|
"github.com/mattermost/mattermost/server/v8/channels/utils"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/marketplace"
|
"github.com/mattermost/mattermost/server/v8/platform/services/marketplace"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ import (
|
|||||||
"github.com/mattermost/mattermost/server/public/model"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
"github.com/mattermost/mattermost/server/public/plugin"
|
"github.com/mattermost/mattermost/server/public/plugin"
|
||||||
"github.com/mattermost/mattermost/server/public/plugin/plugintest"
|
"github.com/mattermost/mattermost/server/public/plugin/plugintest"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/httpservice"
|
||||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
storeMocks "github.com/mattermost/mattermost/server/v8/channels/store/storetest/mocks"
|
storeMocks "github.com/mattermost/mattermost/server/v8/channels/store/storetest/mocks"
|
||||||
"github.com/mattermost/mattermost/server/v8/config"
|
"github.com/mattermost/mattermost/server/v8/config"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/telemetry/mocks"
|
"github.com/mattermost/mattermost/server/v8/platform/services/telemetry/mocks"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -173,7 +173,8 @@ func TestUserAgentIsSet(t *testing.T) {
|
|||||||
|
|
||||||
require.NoError(t, err, "NewRequest failed", err)
|
require.NoError(t, err, "NewRequest failed", err)
|
||||||
|
|
||||||
client.Do(req)
|
_, err = client.Do(req)
|
||||||
|
require.NoError(t, err, "Do failed", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHTTPClient(transport http.RoundTripper) *http.Client {
|
func NewHTTPClient(transport http.RoundTripper) *http.Client {
|
||||||
@@ -10,7 +10,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/v8/platform/services/configservice"
|
"github.com/mattermost/mattermost/server/public/model"
|
||||||
|
"github.com/mattermost/mattermost/server/public/plugin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HTTPService wraps the functionality for making http requests to provide some improvements to the default client
|
// HTTPService wraps the functionality for making http requests to provide some improvements to the default client
|
||||||
@@ -28,8 +29,12 @@ type HTTPService interface {
|
|||||||
MakeTransport(trustURLs bool) *MattermostTransport
|
MakeTransport(trustURLs bool) *MattermostTransport
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type getConfig interface {
|
||||||
|
Config() *model.Config
|
||||||
|
}
|
||||||
|
|
||||||
type HTTPServiceImpl struct {
|
type HTTPServiceImpl struct {
|
||||||
configService configservice.ConfigService
|
configService getConfig
|
||||||
|
|
||||||
RequestTimeout time.Duration
|
RequestTimeout time.Duration
|
||||||
}
|
}
|
||||||
@@ -38,13 +43,25 @@ func splitFields(c rune) bool {
|
|||||||
return unicode.IsSpace(c) || c == ','
|
return unicode.IsSpace(c) || c == ','
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeHTTPService(configService configservice.ConfigService) HTTPService {
|
func MakeHTTPService(configService getConfig) HTTPService {
|
||||||
return &HTTPServiceImpl{
|
return &HTTPServiceImpl{
|
||||||
configService,
|
configService,
|
||||||
RequestTimeout,
|
RequestTimeout,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type pluginAPIConfigServiceAdapter struct {
|
||||||
|
pluginAPIConfigService plugin.API
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *pluginAPIConfigServiceAdapter) Config() *model.Config {
|
||||||
|
return p.pluginAPIConfigService.GetConfig()
|
||||||
|
}
|
||||||
|
|
||||||
|
func MakeHTTPServicePlugin(configService plugin.API) HTTPService {
|
||||||
|
return MakeHTTPService(&pluginAPIConfigServiceAdapter{configService})
|
||||||
|
}
|
||||||
|
|
||||||
func (h *HTTPServiceImpl) MakeClient(trustURLs bool) *http.Client {
|
func (h *HTTPServiceImpl) MakeClient(trustURLs bool) *http.Client {
|
||||||
return &http.Client{
|
return &http.Client{
|
||||||
Transport: h.MakeTransport(trustURLs),
|
Transport: h.MakeTransport(trustURLs),
|
||||||
Ссылка в новой задаче
Block a user