fix: URL encode resource's id before calling API endpoints
This commit is contained in:
parent
03d2e35488
commit
49f04f2772
23 changed files with 408 additions and 29 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
@ -169,6 +170,21 @@ func TestHandler_EntryPoints(t *testing.T) {
|
|||
jsonFile: "testdata/entrypoint-bar.json",
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "one entry point by id containing slash",
|
||||
path: "/api/entrypoints/" + url.PathEscape("foo / bar"),
|
||||
conf: static.Configuration{
|
||||
Global: &static.Global{},
|
||||
API: &static.API{},
|
||||
EntryPoints: map[string]*static.EntryPoint{
|
||||
"foo / bar": {Address: ":81"},
|
||||
},
|
||||
},
|
||||
expected: expected{
|
||||
statusCode: http.StatusOK,
|
||||
jsonFile: "testdata/entrypoint-foo-slash-bar.json",
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "one entry point by id, that does not exist",
|
||||
path: "/api/entrypoints/foo",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue