@@ -36,7 +36,7 @@ func TestHappyPath(t *testing.T) {
3636 t .Errorf ("scope wants %s but %s" , want , req .Scope )
3737 return fmt .Sprintf ("%s?error=invalid_scope" , req .RedirectURI )
3838 }
39- if ! assertRedirectURI (t , req .RedirectURI , "http" , "localhost" ) {
39+ if ! assertRedirectURI (t , req .RedirectURI , "http" , "localhost" , "/" ) {
4040 return fmt .Sprintf ("%s?error=invalid_redirect_uri" , req .RedirectURI )
4141 }
4242 return fmt .Sprintf ("%s?state=%s&code=%s" , req .RedirectURI , req .State , "AUTH_CODE" )
@@ -106,7 +106,7 @@ func TestRedirectURLHostname(t *testing.T) {
106106 t .Errorf ("scope wants %s but %s" , want , req .Scope )
107107 return fmt .Sprintf ("%s?error=invalid_scope" , req .RedirectURI )
108108 }
109- if ! assertRedirectURI (t , req .RedirectURI , "http" , "127.0.0.1" ) {
109+ if ! assertRedirectURI (t , req .RedirectURI , "http" , "127.0.0.1" , "/" ) {
110110 return fmt .Sprintf ("%s?error=invalid_redirect_uri" , req .RedirectURI )
111111 }
112112 return fmt .Sprintf ("%s?state=%s&code=%s" , req .RedirectURI , req .State , "AUTH_CODE" )
@@ -177,7 +177,7 @@ func TestSuccessRedirect(t *testing.T) {
177177 t .Errorf ("scope wants %s but %s" , want , req .Scope )
178178 return fmt .Sprintf ("%s?error=invalid_scope" , req .RedirectURI )
179179 }
180- if ! assertRedirectURI (t , req .RedirectURI , "http" , "localhost" ) {
180+ if ! assertRedirectURI (t , req .RedirectURI , "http" , "localhost" , "/" ) {
181181 return fmt .Sprintf ("%s?error=invalid_redirect_uri" , req .RedirectURI )
182182 }
183183 return fmt .Sprintf ("%s?state=%s&code=%s" , req .RedirectURI , req .State , "AUTH_CODE" )
@@ -242,7 +242,7 @@ func TestSuccessRedirect(t *testing.T) {
242242 wg .Wait ()
243243}
244244
245- func assertRedirectURI (t * testing.T , actualURI , scheme , hostname string ) bool {
245+ func assertRedirectURI (t * testing.T , actualURI , scheme , hostname , path string ) bool {
246246 redirect , err := url .Parse (actualURI )
247247 if err != nil {
248248 t .Errorf ("could not parse redirect_uri: %s" , err )
@@ -256,8 +256,8 @@ func assertRedirectURI(t *testing.T, actualURI, scheme, hostname string) bool {
256256 t .Errorf ("redirect_uri wants hostname %s but was %s" , hostname , actualHostname )
257257 return false
258258 }
259- if redirect .Path != "" {
260- t .Errorf ("redirect_uri wants path `` but was %s" , redirect . Path )
259+ if actualPath := redirect .Path ; actualPath != path {
260+ t .Errorf ("redirect_uri wants path %s but was %s" , path , actualPath )
261261 return false
262262 }
263263 return true
0 commit comments