summaryrefslogtreecommitdiffstats
path: root/app/post.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2018-09-07 09:24:18 -0400
committerGitHub <noreply@github.com>2018-09-07 09:24:18 -0400
commit0027d998555d47f9a75a896d8c6c85a8b4645ad0 (patch)
tree4a15d63c143e9891921d75f102dd008852c9abb2 /app/post.go
parent291000703320cc53c3bdecd2553fa4a3021d7234 (diff)
downloadchat-0027d998555d47f9a75a896d8c6c85a8b4645ad0.tar.gz
chat-0027d998555d47f9a75a896d8c6c85a8b4645ad0.tar.bz2
chat-0027d998555d47f9a75a896d8c6c85a8b4645ad0.zip
MM-11855 Add App.HTTPService to allow mocking of HTTP client (#9359)
* MM-11855 Add App.HTTPService to allow mocking of HTTP client * Initialize HTTPService earlier
Diffstat (limited to 'app/post.go')
-rw-r--r--app/post.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/post.go b/app/post.go
index 30602b392..86c96926e 100644
--- a/app/post.go
+++ b/app/post.go
@@ -777,7 +777,7 @@ func (a *App) GetFileInfosForPost(postId string, readFromMaster bool) ([]*model.
func (a *App) GetOpenGraphMetadata(requestURL string) *opengraph.OpenGraph {
og := opengraph.NewOpenGraph()
- res, err := a.HTTPClient(false).Get(requestURL)
+ res, err := a.HTTPService.MakeClient(false).Get(requestURL)
if err != nil {
mlog.Error(fmt.Sprintf("GetOpenGraphMetadata request failed for url=%v with err=%v", requestURL, err.Error()))
return og
@@ -890,9 +890,9 @@ func (a *App) DoPostAction(postId, actionId, userId, selectedOption string) *mod
siteURL, _ := url.Parse(*a.Config().ServiceSettings.SiteURL)
subpath, _ := utils.GetSubpathFromConfig(a.Config())
if (url.Hostname() == "localhost" || url.Hostname() == "127.0.0.1" || url.Hostname() == siteURL.Hostname()) && strings.HasPrefix(url.Path, path.Join(subpath, "plugins")) {
- httpClient = a.HTTPClient(true)
+ httpClient = a.HTTPService.MakeClient(true)
} else {
- httpClient = a.HTTPClient(false)
+ httpClient = a.HTTPService.MakeClient(false)
}
resp, err := httpClient.Do(req)