fix: avoid redirect loop on workspace proxies (#9389)

* fix: avoid redirect loop on workspace proxies

---------

Co-authored-by: Steven Masley <stevenmasley@coder.com>
This commit is contained in:
Dean Sheather
2023-08-28 20:34:52 -05:00
committed by GitHub
co-authored by Steven Masley
parent eb68684327
commit 5993f85ec9
12 changed files with 265 additions and 99 deletions
+6 -1
View File
@@ -15,6 +15,7 @@ func Test_RequestValidate(t *testing.T) {
cases := []struct {
name string
req workspaceapps.Request
noNormalize bool
errContains string
}{
{
@@ -90,6 +91,7 @@ func Test_RequestValidate(t *testing.T) {
AgentNameOrID: "baz",
AppSlugOrPort: "qux",
},
noNormalize: true,
errContains: "base path is required",
},
{
@@ -215,7 +217,10 @@ func Test_RequestValidate(t *testing.T) {
c := c
t.Run(c.name, func(t *testing.T) {
t.Parallel()
req := c.req.Normalize()
req := c.req
if !c.noNormalize {
req = c.req.Normalize()
}
err := req.Validate()
if c.errContains == "" {
require.NoError(t, err)