Skip to content

Commit 83d5cf0

Browse files
authored
Merge pull request #2823 from ORCID/lmendoza/PD-0000hot-fix-switch-user-issues
PD-5489 hot-fix-switch-user-issues
2 parents dbde17b + e3fac5c commit 83d5cf0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/app/core/http/retry-transient.interceptor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Observable, timer } from 'rxjs'
1010
import { retry } from 'rxjs/operators'
1111

1212
const RETRYABLE_HTTP_STATUSES = new Set([0, 408, 502, 503, 504])
13+
const RETRYABLE_HTTP_METHODS = new Set(['GET', 'HEAD', 'OPTIONS'])
1314
const MAX_RETRIES = 2
1415

1516
@Injectable()
@@ -18,6 +19,12 @@ export class RetryTransientInterceptor implements HttpInterceptor {
1819
req: HttpRequest<unknown>,
1920
next: HttpHandler
2021
): Observable<HttpEvent<unknown>> {
22+
// Retrying non-idempotent requests (e.g. switch-user POST) can trigger
23+
// duplicate server-side actions and break account/session flows.
24+
if (!RETRYABLE_HTTP_METHODS.has(req.method.toUpperCase())) {
25+
return next.handle(req)
26+
}
27+
2128
return next.handle(req).pipe(
2229
retry({
2330
count: MAX_RETRIES,

0 commit comments

Comments
 (0)