/
githubmirror
/
grafana
Обзор
Документация
Войти
/
githubmirror
/
grafana
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
pkg/api/plugin_proxy_test.go
40 строк
841 B
Marcus Efraimsson
Plugins: Preserve trailing slash in plugin proxy (#86859)
05 июн 2024, 14:36
Не верифицирован
05 июн 2024, 14:36
fe3e591
Код
Авторство
О чём код?
package api import ( "testing" "github.com/stretchr/testify/assert" ) func TestExtractPluginProxyPath(t *testing.T) { testCases := []struct { originalRawPath string exp string }{ { "/api/plugin-proxy/test", "", }, { "/api/plugin-proxy/test/some/thing", "some/thing", }, { "/api/plugin-proxy/test2/api/services/afsd%2Fafsd/operations", "api/services/afsd%2Fafsd/operations", }, { "/api/plugin-proxy/cloudflare-app/with-token/api/v4/accounts", "with-token/api/v4/accounts", }, { "/api/plugin-proxy/cloudflare-app/with-token/api/v4/accounts/", "with-token/api/v4/accounts/", }, } for _, tc := range testCases { t.Run("Given raw path, should extract expected proxy path", func(t *testing.T) { assert.Equal(t, tc.exp, extractProxyPath(tc.originalRawPath)) }) } }