Skip to content

retry-after

Full name
@azure-tools/typespec-azure-resource-manager/retry-after

Check if the Retry-After header appears in the response for long-running operations. For long-running operations, the Retry-After header indicates how long the client should wait before polling the operation status. This header should be included in 201 or 202 responses.

Custom long-running operation missing Retry-After header:

@armResourceOperations
interface FooResources {
@Azure.Core.pollingOperation(FooResources.getOperationStatus)
@post
update(): FooResource;
getOperationStatus(): {
status: Status;
};
}

Use ARM operation templates which include the Retry-After header automatically:

@armResourceOperations
interface FooResources {
start is ArmResourceActionAsync<FooResource, FooRequestBody, FooResponse>;
}

Or include Foundations.RetryAfterHeader in your custom response:

@armResourceOperations
interface FooResources {
@Azure.Core.pollingOperation(FooResources.getOperationStatus)
@post
update(): FooResource & Foundations.RetryAfterHeader;
getOperationStatus(): {
status: Status;
};
}