Set headers in RetryLink

I’m interested in adding a header Request-Attempt to help identify requests made via RetryLink functionality, and how many retries may have been attempted.

Looking at the API docs, I don’t see a way to modify operation.headers and forward() from RetryLink. What’s the recommended way to do this?

You should be able to use operation.setContext to modify the headers context property.

Interesting! For some reason I was under the impression that I couldn’t use operation.setContext without being able to then forward(operation), but it seems this does actually work. Is it documented under what conditions you can mutate the operation without forwarding it?

There are no restrictions that I’m aware of - as long as the same operation is reused (which should be the case here), you can just change it before. forward will be called internally by the link to retry.

1 Like