[MM-26463] Keep query parameter for interplugin requests (#14905)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
08457860cc
Коммит
a34ea6ad63
@@ -898,6 +898,7 @@ func (api *PluginAPI) PluginHTTP(request *http.Request) *http.Response {
|
||||
}
|
||||
destinationPluginId := split[1]
|
||||
newURL, err := url.Parse("/" + split[2])
|
||||
newURL.RawQuery = request.URL.Query().Encode()
|
||||
request.URL = newURL
|
||||
if destinationPluginId == "" || err != nil {
|
||||
message := "No plugin specified. Form of URL should be /<pluginid>/*"
|
||||
|
||||
@@ -1381,6 +1381,11 @@ func TestInterpluginPluginHTTP(t *testing.T) {
|
||||
if r.URL.Path != "/api/v2/test" {
|
||||
return
|
||||
}
|
||||
|
||||
if r.URL.Query().Get("abc") != "xyz" {
|
||||
return
|
||||
}
|
||||
|
||||
buf := bytes.Buffer{}
|
||||
buf.ReadFrom(r.Body)
|
||||
resp := "we got:" + buf.String()
|
||||
@@ -1410,7 +1415,7 @@ func TestInterpluginPluginHTTP(t *testing.T) {
|
||||
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
|
||||
buf := bytes.Buffer{}
|
||||
buf.WriteString("This is the request")
|
||||
req, err := http.NewRequest("GET", "/testplugininterserver/api/v2/test", &buf)
|
||||
req, err := http.NewRequest("GET", "/testplugininterserver/api/v2/test?abc=xyz", &buf)
|
||||
if err != nil {
|
||||
return nil, err.Error()
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user