From 0027d998555d47f9a75a896d8c6c85a8b4645ad0 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Fri, 7 Sep 2018 09:24:18 -0400 Subject: 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 --- app/post.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/post.go') 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) -- cgit v1.2.3-1-g7c22