dashboards: redirect from old url used to load dashboard to new url

If legacy backend routes (/dashboard/db/<slug> and /dashboard-solo/db/<slug>)
are requested we try to redirect to new routes with a 301 Moved Permanently
 #7883
This commit is contained in:
Marcus Efraimsson
2018-01-31 14:05:24 +01:00
parent 3efb3d8efa
commit a99331cdb9
4 changed files with 120 additions and 2 deletions

View File

@ -399,6 +399,20 @@ func (sc *scenarioContext) fakeReq(method, url string) *scenarioContext {
return sc
}
func (sc *scenarioContext) fakeReqWithParams(method, url string, queryParams map[string]string) *scenarioContext {
sc.resp = httptest.NewRecorder()
req, err := http.NewRequest(method, url, nil)
q := req.URL.Query()
for k, v := range queryParams {
q.Add(k, v)
}
req.URL.RawQuery = q.Encode()
So(err, ShouldBeNil)
sc.req = req
return sc
}
func (sc *scenarioContext) handler(fn handlerFunc) *scenarioContext {
sc.handlerFunc = fn
return sc