modifyBeforeAttemptCompletion

open suspend fun modifyBeforeAttemptCompletion(context: ResponseInterceptorContext<Input, Output, ProtocolRequest, ProtocolResponse?>): <Error class: unknown class><Output>

A hook called when an attempt is completed. This method has the ability to modify and return a new operation output or error.

When: This will ALWAYS be called once per attempt, except when a failure occurs before readBeforeAttempt This method may be called multiple times in the event of retries.

Available Information: RequestInterceptorContext.request, ProtocolRequestInterceptorContext.protocolRequest, ProtocolResponseInterceptorContext.protocolResponse are ALWAYS available. ResponseInterceptorContext.response is available if execution made it that far.

Modifications: In the event of retries, the context will not include changes made in previous attempts (e.g. by request signers or other interceptors).

Error Behavior: If errors are raised by this hook, execution will jump to readAfterAttempt with the raised error as the ResponseInterceptorContext.response result.