git.iko.soy/typeable/oauth2-proxy
on master help sign in
Test for a file:/// upstream combined with regex path rewrite
commitb618ed7150ce84e7a9811b4304fe665650e49729 authorIan Roberts <i.roberts@dcs.shef.ac.uk> dateThu 21 Sep 2023, 14:55 (3 years ago) parent076d2df
1 file changed+17
pkg/upstream/proxy_test.go+17
pkg/upstream/proxy_test.go+17
@@ -51,6 +51,12 @@ var _ = Describe("Proxy Suite", func() {
5151 Path: "/files/",
5252 URI: fmt.Sprintf("file:///%s", filesDir),
5353 },
54+ {
55+ ID: "rewrite-file-backend",
56+ Path: "^/rewrite-files/.*/(.*)$",
57+ RewriteTarget: "/$1",
58+ URI: fmt.Sprintf("file:///%s", filesDir),
59+ },
5460 {
5561 ID: "static-backend",
5662 Path: "/static/",
@@ -174,6 +180,17 @@ var _ = Describe("Proxy Suite", func() {
174180 },
175181 upstream: "file-backend",
176182 }),
183+ Entry("with a request to the File backend with rewrite", &proxyTableInput{
184+ target: "http://example.localhost/rewrite-files/anything-at-all/foo",
185+ response: testHTTPResponse{
186+ code: 200,
187+ header: map[string][]string{
188+ contentType: {textPlainUTF8},
189+ },
190+ raw: "foo",
191+ },
192+ upstream: "rewrite-file-backend",
193+ }),
177194 Entry("with a request to the Static backend", &proxyTableInput{
178195 target: "http://example.localhost/static/bar",
179196 response: testHTTPResponse{