Add authorization header to request from post action to plugin (#10165)

* Add authorization header to request from post action to plugin
Этот коммит содержится в:
Yusuke Nemoto
2019-02-09 22:22:22 +09:00
коммит произвёл Lev
родитель 0e31ce9110
Коммит 93244fdaa1

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

@@ -138,6 +138,7 @@ func (a *App) DoActionRequest(rawURL string, body []byte) (*http.Response, *mode
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")) {
req.Header.Set(model.HEADER_AUTH, "Bearer "+a.Session.Token)
httpClient = a.HTTPService.MakeClient(true)
} else {
httpClient = a.HTTPService.MakeClient(false)