5.8Setting Timeout

Updated on Aug 20, 2026~3 min read

Sets the timeout duration for a single request.

HTTP Declarative Requests set the timeout through the TimeoutAttribute attribute. The corresponding HTTP declarative extractor is implemented by the TimeoutDeclarativeExtractor type, which is responsible for parsing the TimeoutAttribute attribute and building the timeout configuration required for the HttpRequestBuilder instance.

cs
// Applied on the interface definition, affects all methods[Timeout(100_000)]  // 100 secondspublic interface IHttpService : IHttpDeclarative{    [Get("https://furion.net/")]    Task<string> GetStringAsync();    // Applied on the method    [Timeout(200_000)]   // 200 seconds    [Get("https://furion.net/")]    Task<string> GetStringAsync();}

TimeoutAttribute contains the following constructors and properties:

  • Constructors:

    • new(milliseconds): applies to a method or interface, sets the timeout.
  • Properties:

    • Timeout: the timeout (in milliseconds) (double type).