@@ -191,6 +191,9 @@ func TestOAuthCallbackAutoSelectsSingleInstallTargetAndUpsertsRegistry(t *testin
191191 if err != nil {
192192 t .Fatalf ("parse result redirect: %v" , err )
193193 }
194+ if resultLocation .Scheme != "https" || resultLocation .Host != "spritz.example.test" {
195+ t .Fatalf ("expected result redirect to use Spritz host, got %s" , resultLocation .String ())
196+ }
194197 if resultLocation .Path != "/settings/slack/install/result" {
195198 t .Fatalf ("expected React result route, got %q" , resultLocation .Path )
196199 }
@@ -281,6 +284,9 @@ func TestOAuthCallbackRendersInstallTargetPickerWhenMultipleTargetsAvailable(t *
281284 if err != nil {
282285 t .Fatalf ("parse picker redirect: %v" , err )
283286 }
287+ if redirectURL .Scheme != "https" || redirectURL .Host != "spritz.example.test" {
288+ t .Fatalf ("expected picker redirect to use Spritz host, got %s" , redirectURL .String ())
289+ }
284290 if redirectURL .Path != "/settings/slack/install/select" {
285291 t .Fatalf ("expected React picker route, got %q" , redirectURL .Path )
286292 }
@@ -7600,6 +7606,28 @@ func TestSpritzWebSocketURLPreservesBasePath(t *testing.T) {
76007606 }
76017607}
76027608
7609+ func TestReactRouteURLUsesSpritzBaseURL (t * testing.T ) {
7610+ gateway := newSlackGateway (
7611+ config {SpritzBaseURL : "https://spritz.example.test/app" },
7612+ slog .New (slog .NewTextHandler (io .Discard , nil )),
7613+ )
7614+
7615+ target := gateway .reactRouteURL ("/settings/slack/workspaces/test?teamId=T_workspace_1" )
7616+ parsed , err := url .Parse (target )
7617+ if err != nil {
7618+ t .Fatalf ("parse react route url: %v" , err )
7619+ }
7620+ if parsed .Scheme != "https" || parsed .Host != "spritz.example.test" {
7621+ t .Fatalf ("expected Spritz host, got %s" , target )
7622+ }
7623+ if parsed .Path != "/app/settings/slack/workspaces/test" {
7624+ t .Fatalf ("expected Spritz base path to be preserved, got %q" , parsed .Path )
7625+ }
7626+ if parsed .Query ().Get ("teamId" ) != "T_workspace_1" {
7627+ t .Fatalf ("expected query to be preserved, got %q" , parsed .RawQuery )
7628+ }
7629+ }
7630+
76037631func signSlackRequest (header http.Header , signingSecret string , body []byte , now time.Time ) {
76047632 timestamp := fmt .Sprintf ("%d" , now .Unix ())
76057633 base := "v0:" + timestamp + ":" + string (body )
0 commit comments