Angular / Advanced / Lesson 21
HTTP interceptor boundaries and safe retries
Design bounded HTTP interceptors with explicit request scope, ordering, and mutation retry rules.
On this page
Lesson goals
- Explain request cloning and interceptor ordering.
- Restrict cross-cutting behavior to its intended requests.
- Distinguish safe reads from uncertain write retries.
- Trace scoped request transformations and response events through the configured interceptor chain.
- Design bounded retry and reconciliation policies that respect operation semantics and cancellation.
Identify cross-cutting work
An interceptor sits in an HttpClient chain and can examine a request or its response stream. It is suitable for a consistent, well-scoped policy such as attaching a nonsecret client marker to selected requests. Keep domain-specific decisions in the owning service. Document registration order, matching rules and the behavior for requests that do not match; hidden global policies make failures difficult to diagnose.
Clone a scoped request
The functional interceptor below adds a harmless marker only to relative paths beginning with /api/. Angular requests are immutable, so clone the request before setting its header and pass the result to next. Absolute URLs and other paths pass through untouched. This example is deliberately not an authentication or authorization mechanism and does not establish that a server trusts the marker.
import { HttpInterceptorFn } from "@angular/common/http";
export const clientKindInterceptor: HttpInterceptorFn = (request, next) => {
if (!request.url.startsWith("/api/")) return next(request);
return next(request.clone({ setHeaders: { "X-Client-Kind": "workshop" } }));
};
A request to /api/items includes X-Client-Kind: workshop.
The interceptor clones matching relative API requests and forwards all other requests unchanged.
Register the chain
Provide HttpClient and register the interceptor in application configuration. When several interceptors are present, their order determines how requests travel through the chain and how responses return. Feature injectors can introduce additional configuration boundaries, so verify which client actually serves the request. The snippet needs a compatible Angular host and does not itself start an application or send traffic.
import { ApplicationConfig } from "@angular/core";
import { provideHttpClient, withInterceptors } from "@angular/common/http";
import { clientKindInterceptor } from "./client-kind.interceptor";
export const appConfig: ApplicationConfig = {
providers: [provideHttpClient(withInterceptors([clientKindInterceptor]))]
};
Matching requests from this configured client pass through the interceptor.
The provider installs HttpClient with the example functional interceptor.
Bound retries and write uncertainty
Retrying a failed read may be appropriate with limits, delay and a cancellation path, subject to the service contract. A timeout after a write does not prove that the server failed to commit it; an automatic replay may duplicate work. Retry mutations only with a documented idempotency or reconciliation contract. Never attach credentials to arbitrary destinations, and avoid logging tokens or sensitive request bodies.
Test the chain
Use controlled HTTP tests to assert the header on a matching request and its absence on an unrelated or absolute URL. Verify interceptor order, failure propagation and that cancellation stops owned work. For retry policies, simulate both a recoverable read failure and an uncertain write outcome. Check server-side authorization independently: a client header and a passing interceptor test do not grant access.
Define the policy and its owner
An HTTP interceptor is a useful place for behavior that applies consistently across a deliberately selected set of HttpClient requests. Examples include a request correlation marker, a carefully scoped authentication policy, or a common diagnostic measurement. Start by writing the matching rule, the action, and the behavior when the rule does not match. Keep operation-specific validation, business decisions and recovery in the service that understands the operation. An interceptor registered globally without a clear boundary can affect login, static assets, external endpoints and future features unexpectedly.
A relative URL beginning with /api/ is a useful teaching predicate, not a complete security policy. Resolution depends on the application origin and deployment; absolute URLs, alternate ports, proxies and server redirects require explicit consideration. Attach credentials only when the destination is trusted under the actual deployment contract. A header supplied by a browser cannot prove authorization: the server must authenticate and authorize the operation independently. Do not record bearer tokens, cookies or sensitive payloads in diagnostic logs.
Understand immutable envelopes and mutable bodies
Angular HttpRequest and its header and parameter objects use immutable update patterns. Calling clone produces another request with the requested changes; pass that returned request to next for the changes to travel down the chain. A nonmatching request can be forwarded unchanged. If an interceptor clones and then accidentally forwards the original object, a test of the outgoing request exposes the missing header. Use setHeaders when replacement is intended and consider whether repeated execution should produce the same envelope.
The immutable request envelope does not deeply freeze an arbitrary body object. Mutating a property or pushing into a body array can leak changes into other code or be repeated when an observable is resubscribed. Construct a new body value when a policy legitimately needs a body change, and leave domain transformations in the owning service when possible. A clone protects the envelope but does not by itself make a request safe to replay or prove that a remote server accepted its contents.
Trace the chain in both directions
Functional interceptors configured with withInterceptors execute requests in their configured order. An interceptor calls next to pass the request to the next handler, and response events flow back through the returned observable. This direction matters for timing, header transformations and error handling: the first interceptor can observe the result after inner interceptors have processed it. A synthetic response can intentionally stop downstream processing, so define which behavior is skipped and ensure a cache does not mix users.
An interceptor can inspect an event stream rather than assuming every event is the final response. When observing completion or failure, avoid swallowing an error unless the calling contract deliberately replaces it with a meaningful result. Feature injectors and separately configured clients affect which chain is used; verify the actual client resolution in an isolated Angular test. A diagram or array of interceptor names is useful for reasoning but does not establish the production wiring by itself.
Separate retryable reads from uncertain writes
Retry resubscribes after an error; it is not a proof that the earlier attempt did no work. A bounded read policy needs a defined class of errors, a maximum number of retries, a delay strategy and a cancellation path. A count of two retries means at most three attempts including the original, if each attempt fails and nothing cancels. Avoid retrying authorization errors or invalid input blindly; surface a useful error when the policy is exhausted. Apply the decision only where the endpoint contract allows it.
A timeout after a mutation can occur after the server commits but before the response reaches the client. Replaying a payment or order without a server-supported idempotency contract can duplicate the operation. A stable idempotency key must represent the same logical operation across attempts, and the server must enforce its semantics; a client header alone provides no guarantee. Alternatively reconcile by querying an operation status according to the service contract. Explicitly communicate an uncertain outcome instead of claiming that a timed-out write failed.
Test boundaries and resource lifetimes
Use an isolated Angular HTTP test environment to inspect matching and nonmatching requests, headers and interceptor order. Simulate a recoverable read error followed by a response, exhausted retries, a nonretryable error and a write whose outcome is uncertain. Count actual outgoing attempts and check the final result. A test fixture is evidence for the configured client and simulated responses, not proof of a production server’s idempotency, routing or authorization behavior.
Unsubscription should stop work owned by the observable chain, including a pending delay when the selected operators and implementation support cancellation. Test that no additional request is issued after cancellation instead of assuming a timer or custom side effect was cleaned up. Distinguish a client abort from proof that the server stopped processing: a request may already have reached the server. Record test configuration and keep fixtures synthetic; the examples below describe expected behavior and are not claimed executions.
20 worked examples
1. Forward the cloned request
Problem: Add a header to one matched request without mutating its envelope.
- clone returns a new request with the specified header.
- Passing marked rather than req delivers that new envelope downstream.
const marked = req.clone({ setHeaders: { 'X-Trace': 'demo' } });
return next(marked);
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: The forwarded clone carries X-Trace: demo; the original request remains unchanged.
Why this result follows: The immutable request update only takes effect when the returned clone is forwarded.
2. Forwarding the wrong object
Problem: Diagnose why a constructed header is missing downstream.
- The clone is created but its reference is never forwarded.
- The original request is immutable and remains unaffected by the clone operation.
const marked = req.clone({ setHeaders: { 'X-Trace': 'demo' } });
return next(req);
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: The forwarded original does not receive the new header from marked.
Why this result follows: Creating a clone cannot alter the original request passed to next.
3. Narrow path match
Problem: Classify three request URLs under a relative API predicate.
- Only the first string begins with the exact prefix /api/.
- The absolute external URL begins with its scheme, so this particular predicate does not match it.
const matches = (url: string) => url.startsWith('/api/');
['/api/items', '/assets/logo.svg', 'https://other.test/api/items'].map(matches);
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: The resulting boolean sequence is [true, false, false].
Why this result follows: String prefix matching checks the supplied URL shape and does not itself establish destination trust.
4. Request and response order
Problem: Trace a two-interceptor chain with no short circuit.
- A calls the next handler, which enters B before the backend.
- The response observable returns through the nested handlers in reverse order.
Registration: [A, B]
Request: A -> B -> backend
Response: backend -> B -> A
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: A sees the outgoing request first and the returning response after B in this model.
Why this result follows: Nested request forwarding and response observation produce opposite traversal directions.
5. Retry attempt count
Problem: Count a bounded retry policy for a failing read.
- The configured count describes two resubscriptions after the initial attempt.
- If all attempts fail and no other operator changes the error, the last failure reaches the subscriber.
// Assume each GET attempt errors and no cancellation occurs.
http.get('/api/catalog').pipe(retry({ count: 2 }));
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: At most three attempts occur: the original and two retries, after which the error propagates.
Why this result follows: A retry count bounds additional attempts rather than counting the initial subscription.
6. Replace a header
Problem: Avoid accumulating duplicate marker values across attempts.
- setHeaders replaces the named header value on the clone.
- The original request remains unchanged and must not be forwarded in place of updated.
const updated = req.clone({ setHeaders: { 'X-Client': 'demo' } });
return next(updated);
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: The forwarded request has X-Client set to demo, including when a previous value was present.
Why this result follows: Replacing the named value makes this envelope transformation repeatable for the same input policy.
7. Copy a body before changing it
Problem: Add a field without mutating the caller’s original object.
- Object spread creates a new top-level object before adding source.
- Nested objects remain shared, so deeper mutation still needs a deliberate copy strategy.
const body = { ...req.body, source: 'web' };
return next(req.clone({ body }));
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: The forwarded body has source web; the top-level properties of the original body are not assigned by this fragment.
Why this result follows: Copying the affected level avoids changing that property on the caller’s body object.
8. Repeated body mutation
Problem: Trace an unsafe in-place array change on replay.
- Both calls push into the same array reference.
- A replay can run mutation logic again, so the second push accumulates another marker.
const body = { tags: ['new'] };
function intercept() { body.tags.push('sent'); }
intercept(); intercept();
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: The tags array becomes [new, sent, sent] in this local model.
Why this result follows: Mutable body references retain changes across repeated calls.
9. Do not retry invalid input
Problem: Apply a narrow retry decision to an HTTP status.
- The observed status is not in the explicitly retryable set.
- The caller can correct or report the invalid request without repeating the same failure.
GET /api/items -> 400 Bad Request
Policy: retry transient 503 only, up to two times
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: The policy makes no retry for this 400 response and passes the error to the caller.
Why this result follows: An explicit error classification prevents indiscriminate replay.
10. Recover a temporary read
Problem: Trace a single retry followed by a successful response.
- The first response matches the transient error policy.
- The second response succeeds before the retry allowance is exhausted.
GET /api/catalog attempt 1 -> 503
GET /api/catalog attempt 2 -> 200 { items: [] }
Policy: retry 503 at most twice
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: The second attempt returns the empty item list; no third attempt is needed.
Why this result follows: A bounded retry can recover a permitted read without replaying after success.
11. Uncertain order submission
Problem: Determine whether a timed-out order can be replayed.
- A timeout does not establish whether the server committed the order.
- Without server-enforced deduplication a second POST can create another order.
POST /api/orders -> client timeout
Server record: outcome not yet known
Idempotency contract: absent
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: Do not automatically replay; report uncertainty and reconcile through the operation’s supported path.
Why this result follows: The observed client failure leaves the mutation outcome unresolved.
12. Stable operation key
Problem: Trace a server-supported deduplication contract.
- Both attempts carry the same key and payload for one logical order.
- The stated contract, not the existence of a header alone, supplies deduplication.
Logical order: O-123
Attempt 1: Idempotency-Key K-123 -> response lost
Attempt 2: Idempotency-Key K-123
Server contract: same key and payload return original result
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: Under this stated server contract the second attempt refers to the same logical operation; verify the server actually enforces it.
Why this result follows: A stable key can identify a replay only when the server implements and honors the contract.
13. Changing the key breaks identity
Problem: Identify why a replay can create duplicate work.
- The second request presents a new operation identity.
- The first timeout leaves open the possibility that the first operation committed.
Attempt 1: Idempotency-Key K-1 -> timeout
Attempt 2: Idempotency-Key K-2 -> sent as a new operation
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: The two different keys do not identify the same operation under a key-based deduplication contract.
Why this result follows: Server deduplication cannot associate different keys unless its contract provides another mechanism.
14. Cancel during delay
Problem: Trace ownership of a pending retry timer.
- Unsubscription ends the subscription that owns the pending retry work.
- A custom timer or side effect outside that chain requires its own cleanup and verification.
Attempt 1 -> 503
Retry delay pending
Subscriber unsubscribes before delay completes
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: A correctly owned and cancellable delay should be disposed; test that no second request is issued.
Why this result follows: Cancellation only controls resources attached to the cancelled subscription.
15. Error propagation
Problem: Avoid hiding a failed response in a logging interceptor.
- tap observes the error notification without replacing it under the stated condition.
- The caller can still apply its own error handling after the interceptor.
return next(req).pipe(
tap({ error: () => auditFailure(req.url) })
);
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: The error is observed by the audit callback and remains an error for the subscriber if the callback does not throw.
Why this result follows: Observing an error differs from recovering it with a replacement observable.
16. Response event filtering
Problem: Distinguish a final response from earlier events.
- The event stream may contain events other than the final response.
- The type guard restricts the status observation to the response event.
return next(req).pipe(tap(event => {
if (event.type === HttpEventType.Response) recordStatus(event.status);
}));
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: Only events identified as final HTTP responses enter recordStatus in this fragment.
Why this result follows: Filtering the event type avoids treating progress or sent events as final responses.
17. Short-circuit cache
Problem: Understand which interceptors run on a cached response.
- The cache is first and does not forward the request on a hit.
- Downstream handlers cannot observe a request that never reaches them.
Chain: cache -> logging -> backend
Cache hit: cache returns a synthetic response without calling next
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: Logging and backend are not invoked for this request in the stated chain.
Why this result follows: Returning a synthetic response terminates forwarding at that interceptor.
18. Cache isolation
Problem: Assess a cache keyed only by URL for personalized data.
- Both users map to the same key in the stated cache.
- The response contains identity-specific data and cannot safely be assumed public.
User Ada: GET /api/profile -> { name: Ada }
User Basil: GET /api/profile -> same cache key
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: A shared URL-only cache could return Ada’s profile to Basil; partition or avoid caching according to the authorization contract.
Why this result follows: Cache identity must reflect the scope of the response being reused.
19. Feature client configuration
Problem: Identify an interceptor unexpectedly absent in a feature.
- The feature resolves a separately configured client in this scenario.
- Root registration alone does not establish the features configured on that separate client.
Root client: interceptor A
Feature injector: separately configured HttpClient
Observed feature request: A marker missing
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: Inspect the feature client’s provider configuration and test the actual injection path before assuming A runs.
Why this result follows: Dependency injection boundaries determine which configured HTTP client handles the request.
20. Authorization remains server-side
Problem: Evaluate a client marker on a protected endpoint.
- A caller can construct or alter a client-provided header.
- The server must enforce its own identity and account authorization checks.
Request header: X-Client-Kind: workshop
Server policy: authenticate user and authorize account access
This contextual example is not executed; it requires an appropriately configured Angular test host where applicable.
Expected result: The marker can identify a client convention but does not grant account access.
Why this result follows: A browser-supplied marker is not an authorization decision.
Common errors and fixes
A header is absent from the outgoing request.
- Why it happens
- The immutable request was not replaced by its clone.
- How to fix it
- Pass the cloned request to next.
- Prevent it next time
- Assert the actual request in a controlled HTTP test.
A third-party request receives an internal header.
- Why it happens
- The matching rule is overly broad.
- How to fix it
- Restrict the policy to explicitly intended destinations.
- Prevent it next time
- Test relative, absolute and unrelated URLs.
A write happens twice after a timeout.
- Why it happens
- A retry assumed the first operation could not have committed.
- How to fix it
- Reconcile the outcome using the server contract.
- Prevent it next time
- Use documented idempotency for replayable operations.
20 practice exercises
1. Why does the example leave an absolute external URL unchanged?
Show hint
Compare the beginning of the URL string to the exact relative prefix.
Show worked solution
Its narrow relative-path predicate matches only /api/ paths. This limits the marker to the intended request shape, although real deployments still need an explicit trusted destination policy.
The predicate checks whether the string begins with /api/. An absolute external URL begins with its scheme, so it passes through unchanged in the example. Production credential policies still need an explicit trusted-origin and deployment analysis.
Check your solution
- The absolute URL does not begin with /api/.
- A controlled test verifies its marker remains absent.
2. A save times out after the server may have committed it. Should an interceptor retry automatically?
Show hint
Distinguish a missing response from a confirmed failed mutation.
Show worked solution
Not without a server-supported idempotency or reconciliation contract. The result is uncertain, and replay can create duplicate work. Surface the uncertainty and follow the operation-specific recovery path.
A timeout can occur after the server commits the save, so a replay may duplicate the change. Surface uncertainty and use a server-supported idempotency key or reconciliation path for that operation rather than a blanket interceptor retry.
Check your solution
- The timeout is not treated as proof of rollback.
- Recovery follows the documented server contract.
3. An interceptor clones a request with X-Trace then forwards the original. Explain the observed header.
Show hint
Which object reaches next?
Show worked solution
The original request reaches the next handler, so the header added only to the clone is absent. Pass the clone and assert the outgoing request in an isolated HTTP test.
Check your solution
- The original remains unchanged.
- The forwarded clone contains the expected header.
4. A policy matches only URLs starting /api/. Classify /api/users and https://other.test/api/users.
Show hint
Compare the literal prefixes.
Show worked solution
The relative URL matches and the absolute URL does not because it begins with its scheme. Treat this as a string-shape rule; confirm trusted destinations separately in the actual deployment.
Check your solution
- The relative path matches.
- The external absolute URL is unchanged.
5. Interceptors are registered [A, B]. Trace requests and returned responses when both call next.
Show hint
The response returns through nested handlers.
Show worked solution
The request travels A then B then the backend; the response returns through B then A. Verify the configured client and avoid assuming the same order if a handler short-circuits.
Check your solution
- The request reaches A before B.
- The response reaches B before A.
6. A request body array receives push during interception and the operation is replayed. Predict the risk.
Show hint
The request envelope does not deep-freeze the body.
Show worked solution
Both attempts can mutate the same array and accumulate duplicate entries. Construct a new body at the affected level and test replay with the caller’s original data unchanged.
Check your solution
- The original array is not mutated.
- A replay does not append an extra marker.
7. A read fails twice with 503 then succeeds. Count attempts under retry count two.
Show hint
Include the original subscription.
Show worked solution
There are three attempts: the initial request and two retries. The third response can succeed within this limit; cancellation or a different error policy can end the sequence earlier.
Check your solution
- Two retries permit three total attempts.
- No fourth request is issued.
8. A read returns 400 under a policy retrying only 503. State the next action.
Show hint
Classify the response against the policy.
Show worked solution
The 400 does not match the stated transient status, so propagate it without retrying. Let the owning service or caller handle invalid input according to its operation contract.
Check your solution
- The request is sent once.
- The caller receives the 400 error.
9. An order POST times out after the server may have committed it. Choose a recovery path.
Show hint
Do not infer failure from timeout.
Show worked solution
Surface an uncertain outcome and reconcile using the service’s documented status or idempotency contract. Do not replay automatically without server-supported deduplication because a duplicate order could result.
Check your solution
- The outcome is described as uncertain.
- A second order is not sent blindly.
10. A server supports idempotency keys. Decide whether a retry should generate a fresh key.
Show hint
Identify one logical operation.
Show worked solution
Reuse the stable key and equivalent payload for retries of the same logical operation under the documented server contract. A new key may identify a new operation and defeat deduplication.
Check your solution
- Both attempts use the same operation key.
- Server enforcement is independently verified.
11. A retry delay is pending when the user leaves the screen. Design the cancellation check.
Show hint
Observe outgoing attempts after unsubscription.
Show worked solution
Unsubscribe from the owned chain before its delay expires and assert that no additional request is sent. Verify any custom timer is also disposed; client cancellation cannot prove the server stopped.
Check your solution
- No new request follows cancellation.
- Custom delay work is cleaned up.
12. A logging interceptor replaces every error with an empty array. Explain the caller-visible problem.
Show hint
Recovery changes the observable contract.
Show worked solution
The caller can no longer distinguish an empty successful result from a failed request. Observe the error without replacing it unless a documented operation-specific fallback intentionally communicates that distinction.
Check your solution
- The failure remains observable.
- An empty success is not fabricated.
13. A cache interceptor returns a response before calling next. Which downstream work is skipped?
Show hint
Trace the configured chain.
Show worked solution
Interceptors after the cache and the backend do not receive that request on the cache hit. Document the behavior and ensure logging, authorization and cache identity remain appropriate.
Check your solution
- The backend is not called on the hit.
- Skipped downstream behavior is explicitly considered.
14. A cache uses /api/profile as its sole key for two users. Explain the privacy risk.
Show hint
Both requests map to one entry.
Show worked solution
A response stored for the first user can be served to the second if the cache is shared. Partition by the proper identity scope or avoid caching personalized responses under that policy.
Check your solution
- The collision is identified.
- The second user never receives the first profile.
15. An interceptor logs Authorization and a request body. Propose safer diagnostics.
Show hint
Record only information needed for the investigation.
Show worked solution
Remove credentials and sensitive body data from logs. Record a nonsecret correlation identifier and an appropriately sanitized status or route, and verify logging policy against actual data flows.
Check your solution
- Credentials are absent from logs.
- The remaining diagnostic fields are nonsecret.
16. A request stream emits sent, progress and response events. Record status only for the final response.
Show hint
Filter on the event type.
Show worked solution
Check for HttpEventType.Response before reading the final response status. Keep other events available to the caller if its contract needs progress, and test the complete event sequence.
Check your solution
- Progress is not treated as a final response.
- The response status is recorded once per response event.
17. A feature request lacks the root interceptor header. Identify what to inspect.
Show hint
Find which HttpClient is injected.
Show worked solution
Inspect the feature injector’s providers and the actual HttpClient configuration used for the request. Test the injection path rather than assuming the root chain applies to every separately configured client.
Check your solution
- The resolved client is identified.
- The feature request is asserted in an isolated test.
18. A browser sends X-Client-Kind to a protected endpoint. Explain what the server must still do.
Show hint
A client can choose its headers.
Show worked solution
The server must authenticate the caller and authorize access to the requested resource independently. A marker can describe a client convention but cannot establish identity or grant permissions.
Check your solution
- The marker is not treated as a credential.
- Server authorization is tested independently.
19. A retry policy repeats 503 indefinitely. Describe two controls and their purpose.
Show hint
Bound both attempts and waiting.
Show worked solution
Set a finite retry count and an appropriate delay with a cancellation path. These limit repeated traffic and let the caller stop waiting; classify eligible errors and surface the final failure.
Check your solution
- The maximum attempts are explicit.
- Cancellation and exhaustion are tested.
20. A client aborts a POST after sending it. Can it assume no server change occurred?
Show hint
The request may already have arrived.
Show worked solution
No. Aborting the client subscription does not prove the server stopped processing or rolled back. Treat the result as uncertain and reconcile through the operation’s documented server contract.
Check your solution
- The server outcome is not assumed.
- Reconciliation avoids a blind duplicate write.
Key takeaways
- Clone immutable requests and document interceptor scope.
- Test ordering and nonmatching destinations.
- Treat uncertain writes separately from safe read retries.
- Forward the cloned envelope and avoid mutating shared request bodies.
- Interceptor scope and order must be tested with the actual configured client.
- A timed-out mutation remains uncertain until the server contract resolves it.