From 14c77ea371799a37b837af01973165c5028faf88 Mon Sep 17 00:00:00 2001 From: Naman Anand Date: Wed, 29 Apr 2026 20:04:21 +0530 Subject: [PATCH 01/43] feat(rust): add config-driven retryStatusCodes with legacy/recommended modes (#15421) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(rust): only retry on 408, 429, and 5xx except 500 Added HTTP status code-based retry logic to execute_with_retries. Previously only network errors were retried. Now also retries on 408, 429, and 501-599 status codes with exponential backoff. * fix: update Rust test snapshot for retry status codes * fix: add 5XX hyperlink to features.yml to match TS PR pattern * fix(rust): update changelog wording to match PR pattern * fix(rust): drop retryable response explicitly and add is_retryable_status tests Co-Authored-By: Claude Sonnet 4.6 * fix(rust): remove unnecessary drop(response) — variable already used in guard Co-Authored-By: Claude Sonnet 4.6 * feat(rust): add config-driven retryStatusCodes with legacy/recommended modes - Add retryStatusCodes field to BaseRustConfigSchema (legacy | recommended) - Legacy (default): 408, 429, >= 500 - Recommended: 408, 429, 502, 503, 504 (excludes 500 Internal Server Error) - Apply string replacement in RustProject.ts when config is recommended - Create 1.0.0 migration to auto-pin legacy for existing users - Register Rust SDK migrations in main index - Update features.yml documenting both modes - Revert seed http_client.rs files to legacy behavior * ci: retry after Docker cleanup failures * fix: mark @boundaryml/baml as external in rust-sdk build to fix esbuild native module errors * refactor: use template variable for retryStatusCodes instead of find/replace * fix: update snapshot to match template variable * fix: drop @boundaryml/baml external from build.mjs (now in shared build-utils) * refactor(rust): use array .contains() for retry status check to match TS .includes() pattern Replace chained equality checks with array-style contains: - Legacy: [408, 429].contains(&status_code) || status_code >= 500 - Recommended: [408, 429, 502, 503, 504].contains(&status_code) This makes the generator code structurally identical to the TS generator, which uses [408, 429, 502, 503, 504].includes(statusCode). --------- Co-authored-by: Claude Sonnet 4.6 --- generators/rust/base/src/asIs/http_client.rs | 35 ++++++++++++++++++ .../rust/base/src/project/RustProject.ts | 6 ++++ .../src/custom-config/BaseRustConfigSchema.ts | 1 + .../unreleased/fix-retry-status-codes.yml | 6 ++++ generators/rust/sdk/features.yml | 7 +++- .../__test__/snapshots/http-client-api-key.rs | 35 ++++++++++++++++++ .../src/__test__/index.test.ts | 28 +++++++++++++++ .../src/generators/rust/migrations/1.0.0.ts | 25 +++++++++++++ .../src/generators/rust/migrations/index.ts | 8 +++++ packages/generator-migrations/src/index.ts | 4 +++ .../accept-header/src/core/http_client.rs | 36 +++++++++++++++++++ .../alias-extends/src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/alias/src/core/http_client.rs | 36 +++++++++++++++++++ .../allof-inline/src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/allof/src/core/http_client.rs | 36 +++++++++++++++++++ .../rust-sdk/any-auth/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../audiences/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../basic-auth/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../bytes-download/src/core/http_client.rs | 36 +++++++++++++++++++ .../bytes-upload/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../content-type/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../empty-clients/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/enum/src/core/http_client.rs | 36 +++++++++++++++++++ .../error-property/src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/errors/src/core/http_client.rs | 36 +++++++++++++++++++ .../no-custom-config/src/core/http_client.rs | 36 +++++++++++++++++++ .../readme-config/src/core/http_client.rs | 36 +++++++++++++++++++ .../exhaustive/src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/extends/src/core/http_client.rs | 36 +++++++++++++++++++ .../extra-properties/src/core/http_client.rs | 36 +++++++++++++++++++ .../file-download/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../file-upload/src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/folders/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../header-auth/src/core/http_client.rs | 36 +++++++++++++++++++ .../http-head/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../imdb/imdb/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../license/basic/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/literal/src/core/http_client.rs | 36 +++++++++++++++++++ .../literals-unions/src/core/http_client.rs | 36 +++++++++++++++++++ .../mixed-case/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../multi-line-docs/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../no-environment/src/core/http_client.rs | 36 +++++++++++++++++++ .../no-retries/src/core/http_client.rs | 36 +++++++++++++++++++ .../null-type/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../nullable-optional/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../rust-sdk/nullable/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/object/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../rust-sdk/optional/src/core/http_client.rs | 36 +++++++++++++++++++ .../package-yml/src/core/http_client.rs | 36 +++++++++++++++++++ .../pagination-custom/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../pagination/src/core/http_client.rs | 36 +++++++++++++++++++ .../path-parameters/src/core/http_client.rs | 36 +++++++++++++++++++ .../plain-text/src/core/http_client.rs | 36 +++++++++++++++++++ .../property-access/src/core/http_client.rs | 36 +++++++++++++++++++ .../public-object/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../query-parameters/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../required-nullable/src/core/http_client.rs | 36 +++++++++++++++++++ .../reserved-keywords/src/core/http_client.rs | 36 +++++++++++++++++++ .../response-property/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../with-wire-tests/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../with-wire-tests/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../simple-api/basic/src/core/http_client.rs | 36 +++++++++++++++++++ .../simple-fhir/src/core/http_client.rs | 36 +++++++++++++++++++ .../basic/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../full-custom/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../streaming/src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/trace/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/unions/src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/unknown/src/core/http_client.rs | 36 +++++++++++++++++++ .../url-form-encoded/src/core/http_client.rs | 36 +++++++++++++++++++ .../validation/src/core/http_client.rs | 36 +++++++++++++++++++ .../variables/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ seed/rust-sdk/version/src/core/http_client.rs | 36 +++++++++++++++++++ .../webhook-audience/src/core/http_client.rs | 36 +++++++++++++++++++ .../rust-sdk/webhooks/src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../src/core/http_client.rs | 36 +++++++++++++++++++ .../websocket/src/core/http_client.rs | 36 +++++++++++++++++++ .../x-fern-default/src/core/http_client.rs | 36 +++++++++++++++++++ 138 files changed, 4762 insertions(+), 1 deletion(-) create mode 100644 generators/rust/sdk/changes/unreleased/fix-retry-status-codes.yml create mode 100644 packages/generator-migrations/src/generators/rust/migrations/1.0.0.ts create mode 100644 packages/generator-migrations/src/generators/rust/migrations/index.ts diff --git a/generators/rust/base/src/asIs/http_client.rs b/generators/rust/base/src/asIs/http_client.rs index 233af544a616..eba166c843e0 100644 --- a/generators/rust/base/src/asIs/http_client.rs +++ b/generators/rust/base/src/asIs/http_client.rs @@ -450,6 +450,11 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -468,6 +473,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + {{RETRY_STATUS_CHECK}} + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -645,3 +654,29 @@ impl HttpClient { } {{SSE_METHOD}}} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/generators/rust/base/src/project/RustProject.ts b/generators/rust/base/src/project/RustProject.ts index e89c0b8241b8..6659338f7d6e 100644 --- a/generators/rust/base/src/project/RustProject.ts +++ b/generators/rust/base/src/project/RustProject.ts @@ -97,6 +97,12 @@ export class RustProject extends AbstractProject= 500"; + content = content.replace(/\{\{RETRY_STATUS_CHECK\}\}/g, retryStatusCheck); + if (tomlSections.features) { content = content.replace(/\{\{FEATURES\}\}/g, `\n[features]\n${tomlSections.features}`); } else { diff --git a/generators/rust/codegen/src/custom-config/BaseRustConfigSchema.ts b/generators/rust/codegen/src/custom-config/BaseRustConfigSchema.ts index 10e961aff963..ee589b38355c 100644 --- a/generators/rust/codegen/src/custom-config/BaseRustConfigSchema.ts +++ b/generators/rust/codegen/src/custom-config/BaseRustConfigSchema.ts @@ -49,6 +49,7 @@ export const BaseRustCustomConfigSchema = z.object({ // Example: ["sse"] to only include SSE in default features defaultFeatures: z.array(z.string()).optional(), maxRetries: z.number().int().min(0).optional(), + retryStatusCodes: z.optional(z.enum(["legacy", "recommended"])), // ========================================================================= // Casing Configuration diff --git a/generators/rust/sdk/changes/unreleased/fix-retry-status-codes.yml b/generators/rust/sdk/changes/unreleased/fix-retry-status-codes.yml new file mode 100644 index 000000000000..21ac5637307a --- /dev/null +++ b/generators/rust/sdk/changes/unreleased/fix-retry-status-codes.yml @@ -0,0 +1,6 @@ +- summary: | + Add `retryStatusCodes` configuration option (`legacy` | `recommended`). The default + `legacy` mode preserves existing behavior (retries 408, 429, and all >= 500). The + `recommended` mode only retries 408, 429, 502, 503, 504 (excludes 500 Internal + Server Error to avoid retrying non-idempotent failures). + type: feat diff --git a/generators/rust/sdk/features.yml b/generators/rust/sdk/features.yml index 34eea6251b06..a3c329c6b218 100644 --- a/generators/rust/sdk/features.yml +++ b/generators/rust/sdk/features.yml @@ -26,7 +26,12 @@ features: - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) - - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) + - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + + The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + + - `legacy` (default): Retries `408`, `429`, and all `>= 500` + - `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/generators/rust/sdk/src/__test__/snapshots/http-client-api-key.rs b/generators/rust/sdk/src/__test__/snapshots/http-client-api-key.rs index 233af544a616..eba166c843e0 100644 --- a/generators/rust/sdk/src/__test__/snapshots/http-client-api-key.rs +++ b/generators/rust/sdk/src/__test__/snapshots/http-client-api-key.rs @@ -450,6 +450,11 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -468,6 +473,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + {{RETRY_STATUS_CHECK}} + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -645,3 +654,29 @@ impl HttpClient { } {{SSE_METHOD}}} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/packages/generator-migrations/src/__test__/index.test.ts b/packages/generator-migrations/src/__test__/index.test.ts index f2032d012333..6b811b21c044 100644 --- a/packages/generator-migrations/src/__test__/index.test.ts +++ b/packages/generator-migrations/src/__test__/index.test.ts @@ -162,6 +162,34 @@ describe("@fern-api/generator-migrations", () => { }); }); + describe("Rust SDK migrations", () => { + it("includes Rust SDK migration entries", () => { + expect(migrations["fernapi/fern-rust-sdk"]).toBeDefined(); + expect(migrations["fernapi/fern-rust-sdk"]?.migrations).toBeDefined(); + expect(Array.isArray(migrations["fernapi/fern-rust-sdk"]?.migrations)).toBe(true); + }); + + it("Rust SDK migrations have correct structure", () => { + const module = migrations["fernapi/fern-rust-sdk"]; + + expect(module).toBeDefined(); + expect(module?.migrations.length).toBeGreaterThan(0); + + for (const migration of module?.migrations ?? []) { + expect(migration).toHaveProperty("version"); + expect(migration).toHaveProperty("migrateGeneratorConfig"); + expect(migration).toHaveProperty("migrateGeneratorsYml"); + } + }); + + it("Rust SDK migrations are in semver order", () => { + const module = migrations["fernapi/fern-rust-sdk"]; + const versions = module?.migrations.map((m) => m.version) ?? []; + + expect(versions).toEqual(["1.0.0"]); + }); + }); + describe("generator name lookup", () => { it("returns undefined for generators without migrations", () => { expect(migrations["fernapi/fern-go-sdk"]).toBeUndefined(); diff --git a/packages/generator-migrations/src/generators/rust/migrations/1.0.0.ts b/packages/generator-migrations/src/generators/rust/migrations/1.0.0.ts new file mode 100644 index 000000000000..bcf6a0c8d798 --- /dev/null +++ b/packages/generator-migrations/src/generators/rust/migrations/1.0.0.ts @@ -0,0 +1,25 @@ +import type { Migration } from "@fern-api/migrations-base"; +import { migrateConfig } from "@fern-api/migrations-base"; + +// Migration for version 1.0.0 +// +// Context: +// Version 1.0.0 changes the default retry behavior to only retry on transient +// 5xx status codes (408, 429, 502, 503, 504), excluding 500 Internal Server Error. +// +// Changed Defaults: +// - retryStatusCodes: undefined (legacy behavior: 408, 429, >= 500) → "recommended" (408, 429, 502, 503, 504) +// +// Migration Strategy: +// This migration pins existing users to "legacy" so their retry behavior +// does not change on upgrade. New users get "recommended" by default. +export const migration_1_0_0: Migration = { + version: "1.0.0", + + migrateGeneratorConfig: ({ config }) => + migrateConfig(config, (draft) => { + draft.retryStatusCodes ??= "legacy"; + }), + + migrateGeneratorsYml: ({ document }) => document +}; diff --git a/packages/generator-migrations/src/generators/rust/migrations/index.ts b/packages/generator-migrations/src/generators/rust/migrations/index.ts new file mode 100644 index 000000000000..f63f77459b48 --- /dev/null +++ b/packages/generator-migrations/src/generators/rust/migrations/index.ts @@ -0,0 +1,8 @@ +import type { MigrationModule } from "@fern-api/migrations-base"; +import { migration_1_0_0 } from "./1.0.0.js"; + +const rustSdkMigrations: MigrationModule = { + migrations: [migration_1_0_0] +}; + +export default rustSdkMigrations; diff --git a/packages/generator-migrations/src/index.ts b/packages/generator-migrations/src/index.ts index 14b1d2b6058d..56ecf65b159e 100644 --- a/packages/generator-migrations/src/index.ts +++ b/packages/generator-migrations/src/index.ts @@ -11,6 +11,7 @@ import csharpSdkMigrations from "./generators/csharp/migrations/index.js"; import javaSdkMigrations from "./generators/java/migrations/index.js"; import javaModelMigrations from "./generators/java-model/migrations/index.js"; import pythonSdkMigrations from "./generators/python/migrations/index.js"; +import rustSdkMigrations from "./generators/rust/migrations/index.js"; import typescriptSdkMigrations from "./generators/typescript/migrations/index.js"; /** @@ -37,6 +38,9 @@ export const migrations: Record = { "fernapi/fern-fastapi-server": pythonSdkMigrations, "fernapi/fern-pydantic-model": pythonSdkMigrations, + // Rust SDK + "fernapi/fern-rust-sdk": rustSdkMigrations, + // TypeScript SDK - all variants share the same migrations "fernapi/fern-typescript": typescriptSdkMigrations, "fernapi/fern-typescript-sdk": typescriptSdkMigrations, diff --git a/seed/rust-sdk/accept-header/src/core/http_client.rs b/seed/rust-sdk/accept-header/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/accept-header/src/core/http_client.rs +++ b/seed/rust-sdk/accept-header/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/alias-extends/src/core/http_client.rs b/seed/rust-sdk/alias-extends/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/alias-extends/src/core/http_client.rs +++ b/seed/rust-sdk/alias-extends/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/alias/src/core/http_client.rs b/seed/rust-sdk/alias/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/alias/src/core/http_client.rs +++ b/seed/rust-sdk/alias/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/allof-inline/src/core/http_client.rs b/seed/rust-sdk/allof-inline/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/allof-inline/src/core/http_client.rs +++ b/seed/rust-sdk/allof-inline/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/allof/src/core/http_client.rs b/seed/rust-sdk/allof/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/allof/src/core/http_client.rs +++ b/seed/rust-sdk/allof/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/any-auth/src/core/http_client.rs b/seed/rust-sdk/any-auth/src/core/http_client.rs index 9d308cdcd681..e1b4af18ee40 100644 --- a/seed/rust-sdk/any-auth/src/core/http_client.rs +++ b/seed/rust-sdk/any-auth/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/api-wide-base-path/src/core/http_client.rs b/seed/rust-sdk/api-wide-base-path/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/api-wide-base-path/src/core/http_client.rs +++ b/seed/rust-sdk/api-wide-base-path/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/audiences/src/core/http_client.rs b/seed/rust-sdk/audiences/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/audiences/src/core/http_client.rs +++ b/seed/rust-sdk/audiences/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/basic-auth-environment-variables/src/core/http_client.rs b/seed/rust-sdk/basic-auth-environment-variables/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/basic-auth-environment-variables/src/core/http_client.rs +++ b/seed/rust-sdk/basic-auth-environment-variables/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/basic-auth-pw-omitted/src/core/http_client.rs b/seed/rust-sdk/basic-auth-pw-omitted/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/basic-auth-pw-omitted/src/core/http_client.rs +++ b/seed/rust-sdk/basic-auth-pw-omitted/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/basic-auth/src/core/http_client.rs b/seed/rust-sdk/basic-auth/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/basic-auth/src/core/http_client.rs +++ b/seed/rust-sdk/basic-auth/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/bearer-token-environment-variable/src/core/http_client.rs b/seed/rust-sdk/bearer-token-environment-variable/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/bearer-token-environment-variable/src/core/http_client.rs +++ b/seed/rust-sdk/bearer-token-environment-variable/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/bytes-download/src/core/http_client.rs b/seed/rust-sdk/bytes-download/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/bytes-download/src/core/http_client.rs +++ b/seed/rust-sdk/bytes-download/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/bytes-upload/src/core/http_client.rs b/seed/rust-sdk/bytes-upload/src/core/http_client.rs index b0f1f17718e1..582c3247a471 100644 --- a/seed/rust-sdk/bytes-upload/src/core/http_client.rs +++ b/seed/rust-sdk/bytes-upload/src/core/http_client.rs @@ -491,6 +491,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -509,6 +515,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -684,3 +694,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/circular-references-advanced/src/core/http_client.rs b/seed/rust-sdk/circular-references-advanced/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/circular-references-advanced/src/core/http_client.rs +++ b/seed/rust-sdk/circular-references-advanced/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/circular-references-extends/src/core/http_client.rs b/seed/rust-sdk/circular-references-extends/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/circular-references-extends/src/core/http_client.rs +++ b/seed/rust-sdk/circular-references-extends/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/circular-references/src/core/http_client.rs b/seed/rust-sdk/circular-references/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/circular-references/src/core/http_client.rs +++ b/seed/rust-sdk/circular-references/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/client-side-params/src/core/http_client.rs b/seed/rust-sdk/client-side-params/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/client-side-params/src/core/http_client.rs +++ b/seed/rust-sdk/client-side-params/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/content-type/src/core/http_client.rs b/seed/rust-sdk/content-type/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/content-type/src/core/http_client.rs +++ b/seed/rust-sdk/content-type/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/cross-package-type-names/src/core/http_client.rs b/seed/rust-sdk/cross-package-type-names/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/cross-package-type-names/src/core/http_client.rs +++ b/seed/rust-sdk/cross-package-type-names/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/dollar-string-examples/src/core/http_client.rs b/seed/rust-sdk/dollar-string-examples/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/dollar-string-examples/src/core/http_client.rs +++ b/seed/rust-sdk/dollar-string-examples/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/empty-clients/src/core/http_client.rs b/seed/rust-sdk/empty-clients/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/empty-clients/src/core/http_client.rs +++ b/seed/rust-sdk/empty-clients/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/endpoint-security-auth/src/core/http_client.rs b/seed/rust-sdk/endpoint-security-auth/src/core/http_client.rs index 9d308cdcd681..e1b4af18ee40 100644 --- a/seed/rust-sdk/endpoint-security-auth/src/core/http_client.rs +++ b/seed/rust-sdk/endpoint-security-auth/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/enum/src/core/http_client.rs b/seed/rust-sdk/enum/src/core/http_client.rs index 025d91d81fd0..4c80d717b193 100644 --- a/seed/rust-sdk/enum/src/core/http_client.rs +++ b/seed/rust-sdk/enum/src/core/http_client.rs @@ -521,6 +521,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -539,6 +545,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -767,3 +777,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/error-property/src/core/http_client.rs b/seed/rust-sdk/error-property/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/error-property/src/core/http_client.rs +++ b/seed/rust-sdk/error-property/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/errors/src/core/http_client.rs b/seed/rust-sdk/errors/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/errors/src/core/http_client.rs +++ b/seed/rust-sdk/errors/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/examples/no-custom-config/src/core/http_client.rs b/seed/rust-sdk/examples/no-custom-config/src/core/http_client.rs index 492b08f38d57..b6edac28fbb9 100644 --- a/seed/rust-sdk/examples/no-custom-config/src/core/http_client.rs +++ b/seed/rust-sdk/examples/no-custom-config/src/core/http_client.rs @@ -453,6 +453,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -471,6 +477,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -699,3 +709,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/examples/readme-config/src/core/http_client.rs b/seed/rust-sdk/examples/readme-config/src/core/http_client.rs index 492b08f38d57..b6edac28fbb9 100644 --- a/seed/rust-sdk/examples/readme-config/src/core/http_client.rs +++ b/seed/rust-sdk/examples/readme-config/src/core/http_client.rs @@ -453,6 +453,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -471,6 +477,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -699,3 +709,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/exhaustive/src/core/http_client.rs b/seed/rust-sdk/exhaustive/src/core/http_client.rs index 1550ffb63be3..f04ed40c4be0 100644 --- a/seed/rust-sdk/exhaustive/src/core/http_client.rs +++ b/seed/rust-sdk/exhaustive/src/core/http_client.rs @@ -493,6 +493,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -511,6 +517,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -739,3 +749,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/extends/src/core/http_client.rs b/seed/rust-sdk/extends/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/extends/src/core/http_client.rs +++ b/seed/rust-sdk/extends/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/extra-properties/src/core/http_client.rs b/seed/rust-sdk/extra-properties/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/extra-properties/src/core/http_client.rs +++ b/seed/rust-sdk/extra-properties/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/file-download/src/core/http_client.rs b/seed/rust-sdk/file-download/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/file-download/src/core/http_client.rs +++ b/seed/rust-sdk/file-download/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/file-upload-openapi/src/core/http_client.rs b/seed/rust-sdk/file-upload-openapi/src/core/http_client.rs index 025d91d81fd0..4c80d717b193 100644 --- a/seed/rust-sdk/file-upload-openapi/src/core/http_client.rs +++ b/seed/rust-sdk/file-upload-openapi/src/core/http_client.rs @@ -521,6 +521,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -539,6 +545,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -767,3 +777,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/file-upload/src/core/http_client.rs b/seed/rust-sdk/file-upload/src/core/http_client.rs index 025d91d81fd0..4c80d717b193 100644 --- a/seed/rust-sdk/file-upload/src/core/http_client.rs +++ b/seed/rust-sdk/file-upload/src/core/http_client.rs @@ -521,6 +521,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -539,6 +545,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -767,3 +777,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/folders/src/core/http_client.rs b/seed/rust-sdk/folders/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/folders/src/core/http_client.rs +++ b/seed/rust-sdk/folders/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/header-auth-environment-variable/src/core/http_client.rs b/seed/rust-sdk/header-auth-environment-variable/src/core/http_client.rs index 49e1c020f21f..61ac801041a7 100644 --- a/seed/rust-sdk/header-auth-environment-variable/src/core/http_client.rs +++ b/seed/rust-sdk/header-auth-environment-variable/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/header-auth/src/core/http_client.rs b/seed/rust-sdk/header-auth/src/core/http_client.rs index 49e1c020f21f..61ac801041a7 100644 --- a/seed/rust-sdk/header-auth/src/core/http_client.rs +++ b/seed/rust-sdk/header-auth/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/http-head/src/core/http_client.rs b/seed/rust-sdk/http-head/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/http-head/src/core/http_client.rs +++ b/seed/rust-sdk/http-head/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/idempotency-headers/src/core/http_client.rs b/seed/rust-sdk/idempotency-headers/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/idempotency-headers/src/core/http_client.rs +++ b/seed/rust-sdk/idempotency-headers/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/imdb/imdb-custom-config/src/core/http_client.rs b/seed/rust-sdk/imdb/imdb-custom-config/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/imdb/imdb-custom-config/src/core/http_client.rs +++ b/seed/rust-sdk/imdb/imdb-custom-config/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/imdb/imdb-custom-features/src/core/http_client.rs b/seed/rust-sdk/imdb/imdb-custom-features/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/imdb/imdb-custom-features/src/core/http_client.rs +++ b/seed/rust-sdk/imdb/imdb-custom-features/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/imdb/imdb/src/core/http_client.rs b/seed/rust-sdk/imdb/imdb/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/imdb/imdb/src/core/http_client.rs +++ b/seed/rust-sdk/imdb/imdb/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/inferred-auth-explicit/src/core/http_client.rs b/seed/rust-sdk/inferred-auth-explicit/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/inferred-auth-explicit/src/core/http_client.rs +++ b/seed/rust-sdk/inferred-auth-explicit/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/inferred-auth-implicit-api-key/src/core/http_client.rs b/seed/rust-sdk/inferred-auth-implicit-api-key/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/inferred-auth-implicit-api-key/src/core/http_client.rs +++ b/seed/rust-sdk/inferred-auth-implicit-api-key/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/inferred-auth-implicit-no-expiry/src/core/http_client.rs b/seed/rust-sdk/inferred-auth-implicit-no-expiry/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/inferred-auth-implicit-no-expiry/src/core/http_client.rs +++ b/seed/rust-sdk/inferred-auth-implicit-no-expiry/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/inferred-auth-implicit-reference/src/core/http_client.rs b/seed/rust-sdk/inferred-auth-implicit-reference/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/inferred-auth-implicit-reference/src/core/http_client.rs +++ b/seed/rust-sdk/inferred-auth-implicit-reference/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/inferred-auth-implicit/src/core/http_client.rs b/seed/rust-sdk/inferred-auth-implicit/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/inferred-auth-implicit/src/core/http_client.rs +++ b/seed/rust-sdk/inferred-auth-implicit/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/license/basic/src/core/http_client.rs b/seed/rust-sdk/license/basic/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/license/basic/src/core/http_client.rs +++ b/seed/rust-sdk/license/basic/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/license/both-license-options/src/core/http_client.rs b/seed/rust-sdk/license/both-license-options/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/license/both-license-options/src/core/http_client.rs +++ b/seed/rust-sdk/license/both-license-options/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/license/custom-license-file/src/core/http_client.rs b/seed/rust-sdk/license/custom-license-file/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/license/custom-license-file/src/core/http_client.rs +++ b/seed/rust-sdk/license/custom-license-file/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/license/empty-license-file/src/core/http_client.rs b/seed/rust-sdk/license/empty-license-file/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/license/empty-license-file/src/core/http_client.rs +++ b/seed/rust-sdk/license/empty-license-file/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/literal/src/core/http_client.rs b/seed/rust-sdk/literal/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/literal/src/core/http_client.rs +++ b/seed/rust-sdk/literal/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/literals-unions/src/core/http_client.rs b/seed/rust-sdk/literals-unions/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/literals-unions/src/core/http_client.rs +++ b/seed/rust-sdk/literals-unions/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/mixed-case/src/core/http_client.rs b/seed/rust-sdk/mixed-case/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/mixed-case/src/core/http_client.rs +++ b/seed/rust-sdk/mixed-case/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/mixed-file-directory/src/core/http_client.rs b/seed/rust-sdk/mixed-file-directory/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/mixed-file-directory/src/core/http_client.rs +++ b/seed/rust-sdk/mixed-file-directory/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/multi-line-docs/src/core/http_client.rs b/seed/rust-sdk/multi-line-docs/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/multi-line-docs/src/core/http_client.rs +++ b/seed/rust-sdk/multi-line-docs/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/multi-url-environment-no-default/src/core/http_client.rs b/seed/rust-sdk/multi-url-environment-no-default/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/multi-url-environment-no-default/src/core/http_client.rs +++ b/seed/rust-sdk/multi-url-environment-no-default/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/multi-url-environment-reference/src/core/http_client.rs b/seed/rust-sdk/multi-url-environment-reference/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/multi-url-environment-reference/src/core/http_client.rs +++ b/seed/rust-sdk/multi-url-environment-reference/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/multi-url-environment/src/core/http_client.rs b/seed/rust-sdk/multi-url-environment/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/multi-url-environment/src/core/http_client.rs +++ b/seed/rust-sdk/multi-url-environment/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/multiple-request-bodies/src/core/http_client.rs b/seed/rust-sdk/multiple-request-bodies/src/core/http_client.rs index b0f1f17718e1..582c3247a471 100644 --- a/seed/rust-sdk/multiple-request-bodies/src/core/http_client.rs +++ b/seed/rust-sdk/multiple-request-bodies/src/core/http_client.rs @@ -491,6 +491,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -509,6 +515,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -684,3 +694,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/no-content-response/src/core/http_client.rs b/seed/rust-sdk/no-content-response/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/no-content-response/src/core/http_client.rs +++ b/seed/rust-sdk/no-content-response/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/no-environment/src/core/http_client.rs b/seed/rust-sdk/no-environment/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/no-environment/src/core/http_client.rs +++ b/seed/rust-sdk/no-environment/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/no-retries/src/core/http_client.rs b/seed/rust-sdk/no-retries/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/no-retries/src/core/http_client.rs +++ b/seed/rust-sdk/no-retries/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/null-type/src/core/http_client.rs b/seed/rust-sdk/null-type/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/null-type/src/core/http_client.rs +++ b/seed/rust-sdk/null-type/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/nullable-allof-extends/src/core/http_client.rs b/seed/rust-sdk/nullable-allof-extends/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/nullable-allof-extends/src/core/http_client.rs +++ b/seed/rust-sdk/nullable-allof-extends/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/nullable-optional/src/core/http_client.rs b/seed/rust-sdk/nullable-optional/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/nullable-optional/src/core/http_client.rs +++ b/seed/rust-sdk/nullable-optional/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/nullable-request-body/src/core/http_client.rs b/seed/rust-sdk/nullable-request-body/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/nullable-request-body/src/core/http_client.rs +++ b/seed/rust-sdk/nullable-request-body/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/nullable/src/core/http_client.rs b/seed/rust-sdk/nullable/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/nullable/src/core/http_client.rs +++ b/seed/rust-sdk/nullable/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/oauth-client-credentials-custom/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-custom/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/oauth-client-credentials-custom/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-custom/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/oauth-client-credentials-default/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-default/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/oauth-client-credentials-default/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-default/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/oauth-client-credentials-environment-variables/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-environment-variables/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/oauth-client-credentials-environment-variables/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-environment-variables/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/oauth-client-credentials-mandatory-auth/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-mandatory-auth/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/oauth-client-credentials-mandatory-auth/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-mandatory-auth/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/oauth-client-credentials-nested-root/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-nested-root/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/oauth-client-credentials-nested-root/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-nested-root/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/oauth-client-credentials-openapi/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-openapi/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/oauth-client-credentials-openapi/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-openapi/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/oauth-client-credentials-reference/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-reference/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/oauth-client-credentials-reference/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-reference/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/oauth-client-credentials-with-variables/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-with-variables/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/oauth-client-credentials-with-variables/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-with-variables/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/oauth-client-credentials/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/oauth-client-credentials/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/object/src/core/http_client.rs b/seed/rust-sdk/object/src/core/http_client.rs index 492b08f38d57..b6edac28fbb9 100644 --- a/seed/rust-sdk/object/src/core/http_client.rs +++ b/seed/rust-sdk/object/src/core/http_client.rs @@ -453,6 +453,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -471,6 +477,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -699,3 +709,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/objects-with-imports/src/core/http_client.rs b/seed/rust-sdk/objects-with-imports/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/objects-with-imports/src/core/http_client.rs +++ b/seed/rust-sdk/objects-with-imports/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/optional/src/core/http_client.rs b/seed/rust-sdk/optional/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/optional/src/core/http_client.rs +++ b/seed/rust-sdk/optional/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/package-yml/src/core/http_client.rs b/seed/rust-sdk/package-yml/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/package-yml/src/core/http_client.rs +++ b/seed/rust-sdk/package-yml/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/pagination-custom/src/core/http_client.rs b/seed/rust-sdk/pagination-custom/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/pagination-custom/src/core/http_client.rs +++ b/seed/rust-sdk/pagination-custom/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/pagination-uri-path/src/core/http_client.rs b/seed/rust-sdk/pagination-uri-path/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/pagination-uri-path/src/core/http_client.rs +++ b/seed/rust-sdk/pagination-uri-path/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/pagination/src/core/http_client.rs b/seed/rust-sdk/pagination/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/pagination/src/core/http_client.rs +++ b/seed/rust-sdk/pagination/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/path-parameters/src/core/http_client.rs b/seed/rust-sdk/path-parameters/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/path-parameters/src/core/http_client.rs +++ b/seed/rust-sdk/path-parameters/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/plain-text/src/core/http_client.rs b/seed/rust-sdk/plain-text/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/plain-text/src/core/http_client.rs +++ b/seed/rust-sdk/plain-text/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/property-access/src/core/http_client.rs b/seed/rust-sdk/property-access/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/property-access/src/core/http_client.rs +++ b/seed/rust-sdk/property-access/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/public-object/src/core/http_client.rs b/seed/rust-sdk/public-object/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/public-object/src/core/http_client.rs +++ b/seed/rust-sdk/public-object/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/query-param-name-conflict/src/core/http_client.rs b/seed/rust-sdk/query-param-name-conflict/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/query-param-name-conflict/src/core/http_client.rs +++ b/seed/rust-sdk/query-param-name-conflict/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/query-parameters-openapi-as-objects/src/core/http_client.rs b/seed/rust-sdk/query-parameters-openapi-as-objects/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/query-parameters-openapi-as-objects/src/core/http_client.rs +++ b/seed/rust-sdk/query-parameters-openapi-as-objects/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/query-parameters-openapi/src/core/http_client.rs b/seed/rust-sdk/query-parameters-openapi/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/query-parameters-openapi/src/core/http_client.rs +++ b/seed/rust-sdk/query-parameters-openapi/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/query-parameters/src/core/http_client.rs b/seed/rust-sdk/query-parameters/src/core/http_client.rs index 492b08f38d57..b6edac28fbb9 100644 --- a/seed/rust-sdk/query-parameters/src/core/http_client.rs +++ b/seed/rust-sdk/query-parameters/src/core/http_client.rs @@ -453,6 +453,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -471,6 +477,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -699,3 +709,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/request-parameters/src/core/http_client.rs b/seed/rust-sdk/request-parameters/src/core/http_client.rs index 492b08f38d57..b6edac28fbb9 100644 --- a/seed/rust-sdk/request-parameters/src/core/http_client.rs +++ b/seed/rust-sdk/request-parameters/src/core/http_client.rs @@ -453,6 +453,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -471,6 +477,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -699,3 +709,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/required-nullable/src/core/http_client.rs b/seed/rust-sdk/required-nullable/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/required-nullable/src/core/http_client.rs +++ b/seed/rust-sdk/required-nullable/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/reserved-keywords/src/core/http_client.rs b/seed/rust-sdk/reserved-keywords/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/reserved-keywords/src/core/http_client.rs +++ b/seed/rust-sdk/reserved-keywords/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/response-property/src/core/http_client.rs b/seed/rust-sdk/response-property/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/response-property/src/core/http_client.rs +++ b/seed/rust-sdk/response-property/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/schemaless-request-body-examples/src/core/http_client.rs b/seed/rust-sdk/schemaless-request-body-examples/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/schemaless-request-body-examples/src/core/http_client.rs +++ b/seed/rust-sdk/schemaless-request-body-examples/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/core/http_client.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/core/http_client.rs index 6d312c412bf1..dca519ee2ad8 100644 --- a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/core/http_client.rs +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -743,3 +753,29 @@ impl HttpClient { crate::SseStream::new(response, terminator, timeout).await } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/server-sent-events-openapi/src/core/http_client.rs b/seed/rust-sdk/server-sent-events-openapi/src/core/http_client.rs index 6d312c412bf1..dca519ee2ad8 100644 --- a/seed/rust-sdk/server-sent-events-openapi/src/core/http_client.rs +++ b/seed/rust-sdk/server-sent-events-openapi/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -743,3 +753,29 @@ impl HttpClient { crate::SseStream::new(response, terminator, timeout).await } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/server-sent-events/with-wire-tests/src/core/http_client.rs b/seed/rust-sdk/server-sent-events/with-wire-tests/src/core/http_client.rs index 6d312c412bf1..dca519ee2ad8 100644 --- a/seed/rust-sdk/server-sent-events/with-wire-tests/src/core/http_client.rs +++ b/seed/rust-sdk/server-sent-events/with-wire-tests/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -743,3 +753,29 @@ impl HttpClient { crate::SseStream::new(response, terminator, timeout).await } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/server-url-templating/src/core/http_client.rs b/seed/rust-sdk/server-url-templating/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/server-url-templating/src/core/http_client.rs +++ b/seed/rust-sdk/server-url-templating/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/simple-api/basic-custom-config/src/core/http_client.rs b/seed/rust-sdk/simple-api/basic-custom-config/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/simple-api/basic-custom-config/src/core/http_client.rs +++ b/seed/rust-sdk/simple-api/basic-custom-config/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/simple-api/basic/src/core/http_client.rs b/seed/rust-sdk/simple-api/basic/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/simple-api/basic/src/core/http_client.rs +++ b/seed/rust-sdk/simple-api/basic/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/simple-fhir/src/core/http_client.rs b/seed/rust-sdk/simple-fhir/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/simple-fhir/src/core/http_client.rs +++ b/seed/rust-sdk/simple-fhir/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/single-url-environment-default/basic/src/core/http_client.rs b/seed/rust-sdk/single-url-environment-default/basic/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/single-url-environment-default/basic/src/core/http_client.rs +++ b/seed/rust-sdk/single-url-environment-default/basic/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/single-url-environment-default/custom-environment/src/core/http_client.rs b/seed/rust-sdk/single-url-environment-default/custom-environment/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/single-url-environment-default/custom-environment/src/core/http_client.rs +++ b/seed/rust-sdk/single-url-environment-default/custom-environment/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/single-url-environment-default/full-custom/src/core/http_client.rs b/seed/rust-sdk/single-url-environment-default/full-custom/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/single-url-environment-default/full-custom/src/core/http_client.rs +++ b/seed/rust-sdk/single-url-environment-default/full-custom/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/single-url-environment-no-default/src/core/http_client.rs b/seed/rust-sdk/single-url-environment-no-default/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/single-url-environment-no-default/src/core/http_client.rs +++ b/seed/rust-sdk/single-url-environment-no-default/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/streaming-parameter/src/core/http_client.rs b/seed/rust-sdk/streaming-parameter/src/core/http_client.rs index 6d312c412bf1..dca519ee2ad8 100644 --- a/seed/rust-sdk/streaming-parameter/src/core/http_client.rs +++ b/seed/rust-sdk/streaming-parameter/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -743,3 +753,29 @@ impl HttpClient { crate::SseStream::new(response, terminator, timeout).await } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/streaming/src/core/http_client.rs b/seed/rust-sdk/streaming/src/core/http_client.rs index 6d312c412bf1..dca519ee2ad8 100644 --- a/seed/rust-sdk/streaming/src/core/http_client.rs +++ b/seed/rust-sdk/streaming/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -743,3 +753,29 @@ impl HttpClient { crate::SseStream::new(response, terminator, timeout).await } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/trace/src/core/http_client.rs b/seed/rust-sdk/trace/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/trace/src/core/http_client.rs +++ b/seed/rust-sdk/trace/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/undiscriminated-union-with-response-property/src/core/http_client.rs b/seed/rust-sdk/undiscriminated-union-with-response-property/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/undiscriminated-union-with-response-property/src/core/http_client.rs +++ b/seed/rust-sdk/undiscriminated-union-with-response-property/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/undiscriminated-unions/src/core/http_client.rs b/seed/rust-sdk/undiscriminated-unions/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/undiscriminated-unions/src/core/http_client.rs +++ b/seed/rust-sdk/undiscriminated-unions/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/unions-with-local-date/src/core/http_client.rs b/seed/rust-sdk/unions-with-local-date/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/unions-with-local-date/src/core/http_client.rs +++ b/seed/rust-sdk/unions-with-local-date/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/unions/src/core/http_client.rs b/seed/rust-sdk/unions/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/unions/src/core/http_client.rs +++ b/seed/rust-sdk/unions/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/unknown/src/core/http_client.rs b/seed/rust-sdk/unknown/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/unknown/src/core/http_client.rs +++ b/seed/rust-sdk/unknown/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/url-form-encoded/src/core/http_client.rs b/seed/rust-sdk/url-form-encoded/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/url-form-encoded/src/core/http_client.rs +++ b/seed/rust-sdk/url-form-encoded/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/validation/src/core/http_client.rs b/seed/rust-sdk/validation/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/validation/src/core/http_client.rs +++ b/seed/rust-sdk/validation/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/variables/src/core/http_client.rs b/seed/rust-sdk/variables/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/variables/src/core/http_client.rs +++ b/seed/rust-sdk/variables/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/version-no-default/src/core/http_client.rs b/seed/rust-sdk/version-no-default/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/version-no-default/src/core/http_client.rs +++ b/seed/rust-sdk/version-no-default/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/version/src/core/http_client.rs b/seed/rust-sdk/version/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/version/src/core/http_client.rs +++ b/seed/rust-sdk/version/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/webhook-audience/src/core/http_client.rs b/seed/rust-sdk/webhook-audience/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/webhook-audience/src/core/http_client.rs +++ b/seed/rust-sdk/webhook-audience/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/webhooks/src/core/http_client.rs b/seed/rust-sdk/webhooks/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/webhooks/src/core/http_client.rs +++ b/seed/rust-sdk/webhooks/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/websocket-bearer-auth/src/core/http_client.rs b/seed/rust-sdk/websocket-bearer-auth/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/websocket-bearer-auth/src/core/http_client.rs +++ b/seed/rust-sdk/websocket-bearer-auth/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/websocket-inferred-auth/src/core/http_client.rs b/seed/rust-sdk/websocket-inferred-auth/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/websocket-inferred-auth/src/core/http_client.rs +++ b/seed/rust-sdk/websocket-inferred-auth/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/websocket-multi-url/src/core/http_client.rs b/seed/rust-sdk/websocket-multi-url/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/websocket-multi-url/src/core/http_client.rs +++ b/seed/rust-sdk/websocket-multi-url/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/websocket/src/core/http_client.rs b/seed/rust-sdk/websocket/src/core/http_client.rs index eb88e6419cd1..5d20493bb524 100644 --- a/seed/rust-sdk/websocket/src/core/http_client.rs +++ b/seed/rust-sdk/websocket/src/core/http_client.rs @@ -450,6 +450,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -468,6 +474,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -645,3 +655,29 @@ impl HttpClient { } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/x-fern-default/src/core/http_client.rs b/seed/rust-sdk/x-fern-default/src/core/http_client.rs index 9c8e7f672d30..d5b11fc4094f 100644 --- a/seed/rust-sdk/x-fern-default/src/core/http_client.rs +++ b/seed/rust-sdk/x-fern-default/src/core/http_client.rs @@ -451,6 +451,12 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { + drop(response); + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +475,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +654,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} From c7f5a03ec7f7edfccdf02c886ca479b25668e9f5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 14:38:30 +0000 Subject: [PATCH 02/43] chore(rust): release 0.35.0 --- .../{unreleased => 0.35.0}/fix-retry-status-codes.yml | 0 generators/rust/sdk/versions.yml | 10 ++++++++++ 2 files changed, 10 insertions(+) rename generators/rust/sdk/changes/{unreleased => 0.35.0}/fix-retry-status-codes.yml (100%) diff --git a/generators/rust/sdk/changes/unreleased/fix-retry-status-codes.yml b/generators/rust/sdk/changes/0.35.0/fix-retry-status-codes.yml similarity index 100% rename from generators/rust/sdk/changes/unreleased/fix-retry-status-codes.yml rename to generators/rust/sdk/changes/0.35.0/fix-retry-status-codes.yml diff --git a/generators/rust/sdk/versions.yml b/generators/rust/sdk/versions.yml index ae5624e22af0..ea3de381a20f 100644 --- a/generators/rust/sdk/versions.yml +++ b/generators/rust/sdk/versions.yml @@ -1,4 +1,14 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 0.35.0 + changelogEntry: + - summary: | + Add `retryStatusCodes` configuration option (`legacy` | `recommended`). The default + `legacy` mode preserves existing behavior (retries 408, 429, and all >= 500). The + `recommended` mode only retries 408, 429, 502, 503, 504 (excludes 500 Internal + Server Error to avoid retrying non-idempotent failures). + type: feat + createdAt: "2026-04-29" + irVersion: 66 - version: 0.34.0 changelogEntry: - summary: | From 2dcfbb2bd94d39ae3e9a817793dfceb5ecfd50c7 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 10:47:48 -0400 Subject: [PATCH 03/43] chore(rust): update rust-sdk seed (#15560) Co-authored-by: iamnamananand996 <31537362+iamnamananand996@users.noreply.github.com> --- seed/rust-sdk/accept-header/README.md | 7 +++- .../accept-header/src/core/http_client.rs | 6 ++- seed/rust-sdk/alias-extends/README.md | 7 +++- .../alias-extends/src/core/http_client.rs | 6 ++- seed/rust-sdk/alias/README.md | 7 +++- seed/rust-sdk/alias/src/core/http_client.rs | 6 ++- seed/rust-sdk/allof-inline/README.md | 7 +++- .../allof-inline/src/core/http_client.rs | 6 ++- seed/rust-sdk/allof/README.md | 7 +++- seed/rust-sdk/allof/src/core/http_client.rs | 6 ++- seed/rust-sdk/any-auth/README.md | 7 +++- .../rust-sdk/any-auth/src/core/http_client.rs | 6 ++- seed/rust-sdk/api-wide-base-path/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/audiences/README.md | 7 +++- .../audiences/src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/basic-auth-pw-omitted/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/basic-auth/README.md | 7 +++- .../basic-auth/src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/bytes-download/README.md | 7 +++- .../bytes-download/src/core/http_client.rs | 6 ++- seed/rust-sdk/bytes-upload/README.md | 7 +++- .../bytes-upload/src/core/http_client.rs | 6 ++- .../src/core/http_client.rs | 6 ++- .../src/core/http_client.rs | 6 ++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/client-side-params/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/content-type/README.md | 7 +++- .../content-type/src/core/http_client.rs | 6 ++- .../cross-package-type-names/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../src/core/http_client.rs | 6 ++- .../empty-clients/src/core/http_client.rs | 6 ++- .../rust-sdk/endpoint-security-auth/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/enum/README.md | 7 +++- seed/rust-sdk/enum/src/core/http_client.rs | 6 ++- seed/rust-sdk/error-property/README.md | 7 +++- .../error-property/src/core/http_client.rs | 6 ++- seed/rust-sdk/errors/README.md | 7 +++- seed/rust-sdk/errors/src/core/http_client.rs | 6 ++- .../examples/no-custom-config/README.md | 7 +++- .../no-custom-config/src/core/http_client.rs | 6 ++- .../rust-sdk/examples/readme-config/README.md | 7 +++- .../readme-config/src/core/http_client.rs | 6 ++- seed/rust-sdk/exhaustive/README.md | 7 +++- .../exhaustive/src/core/http_client.rs | 6 ++- seed/rust-sdk/extends/README.md | 7 +++- seed/rust-sdk/extends/src/core/http_client.rs | 6 ++- seed/rust-sdk/extra-properties/README.md | 7 +++- .../extra-properties/src/core/http_client.rs | 6 ++- seed/rust-sdk/file-download/README.md | 7 +++- .../file-download/src/core/http_client.rs | 6 ++- seed/rust-sdk/file-upload-openapi/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/file-upload/README.md | 7 +++- .../file-upload/src/core/http_client.rs | 6 ++- seed/rust-sdk/folders/README.md | 7 +++- seed/rust-sdk/folders/src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/header-auth/README.md | 7 +++- .../header-auth/src/core/http_client.rs | 6 ++- seed/rust-sdk/http-head/README.md | 7 +++- .../http-head/src/core/http_client.rs | 6 ++- seed/rust-sdk/idempotency-headers/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../imdb/imdb-custom-config/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../imdb/imdb-custom-features/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/imdb/imdb/README.md | 7 +++- .../imdb/imdb/src/core/http_client.rs | 6 ++- .../rust-sdk/inferred-auth-explicit/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../inferred-auth-implicit-api-key/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../rust-sdk/inferred-auth-implicit/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/license/basic/README.md | 7 +++- .../license/basic/src/core/http_client.rs | 6 ++- .../license/both-license-options/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../license/custom-license-file/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../license/empty-license-file/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/literal/README.md | 7 +++- seed/rust-sdk/literal/src/core/http_client.rs | 6 ++- .../literals-unions/src/core/http_client.rs | 6 ++- seed/rust-sdk/mixed-case/README.md | 7 +++- .../mixed-case/src/core/http_client.rs | 6 ++- seed/rust-sdk/mixed-file-directory/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/multi-line-docs/README.md | 7 +++- .../multi-line-docs/src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../multi-url-environment-reference/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/multi-url-environment/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../multiple-request-bodies/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/no-content-response/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/no-environment/README.md | 7 +++- .../no-environment/src/core/http_client.rs | 6 ++- seed/rust-sdk/no-retries/README.md | 7 +++- .../no-retries/src/core/http_client.rs | 6 ++- seed/rust-sdk/null-type/README.md | 7 +++- .../null-type/src/core/http_client.rs | 6 ++- .../rust-sdk/nullable-allof-extends/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/nullable-optional/README.md | 7 +++- .../nullable-optional/src/core/http_client.rs | 6 ++- seed/rust-sdk/nullable-request-body/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/nullable/README.md | 7 +++- .../rust-sdk/nullable/src/core/http_client.rs | 6 ++- .../oauth-client-credentials-custom/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../oauth-client-credentials/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/object/src/core/http_client.rs | 6 ++- .../src/core/http_client.rs | 6 ++- .../openapi-request-body-ref/README.md | 7 +++- .../src/core/http_client.rs | 38 +++++++++++++++++++ seed/rust-sdk/optional/README.md | 7 +++- .../rust-sdk/optional/src/core/http_client.rs | 6 ++- seed/rust-sdk/package-yml/README.md | 7 +++- .../package-yml/src/core/http_client.rs | 6 ++- seed/rust-sdk/pagination-custom/README.md | 7 +++- .../pagination-custom/src/core/http_client.rs | 6 ++- seed/rust-sdk/pagination-uri-path/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/pagination/README.md | 7 +++- .../pagination/src/core/http_client.rs | 6 ++- seed/rust-sdk/path-parameters/README.md | 7 +++- .../path-parameters/src/core/http_client.rs | 6 ++- seed/rust-sdk/plain-text/README.md | 7 +++- .../plain-text/src/core/http_client.rs | 6 ++- seed/rust-sdk/property-access/README.md | 7 +++- .../property-access/src/core/http_client.rs | 6 ++- .../public-object/src/core/http_client.rs | 6 ++- .../query-param-name-conflict/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../query-parameters-openapi/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/query-parameters/README.md | 7 +++- .../query-parameters/src/core/http_client.rs | 6 ++- seed/rust-sdk/request-parameters/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/required-nullable/README.md | 7 +++- .../required-nullable/src/core/http_client.rs | 6 ++- seed/rust-sdk/reserved-keywords/README.md | 7 +++- .../reserved-keywords/src/core/http_client.rs | 6 ++- seed/rust-sdk/response-property/README.md | 7 +++- .../response-property/src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../with-wire-tests/README.md | 7 +++- .../with-wire-tests/src/core/http_client.rs | 6 ++- .../server-sent-events-openapi/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../with-wire-tests/README.md | 7 +++- .../with-wire-tests/src/core/http_client.rs | 6 ++- seed/rust-sdk/server-url-templating/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../simple-api/basic-custom-config/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/simple-api/basic/README.md | 7 +++- .../simple-api/basic/src/core/http_client.rs | 6 ++- seed/rust-sdk/simple-fhir/README.md | 7 +++- .../simple-fhir/src/core/http_client.rs | 6 ++- .../basic/README.md | 7 +++- .../basic/src/core/http_client.rs | 6 ++- .../custom-environment/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../full-custom/README.md | 7 +++- .../full-custom/src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/streaming-parameter/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/streaming/README.md | 7 +++- .../streaming/src/core/http_client.rs | 6 ++- seed/rust-sdk/trace/README.md | 7 +++- seed/rust-sdk/trace/src/core/http_client.rs | 6 ++- .../README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../rust-sdk/undiscriminated-unions/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../rust-sdk/union-query-parameters/README.md | 7 +++- .../src/core/http_client.rs | 38 +++++++++++++++++++ .../rust-sdk/unions-with-local-date/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/unions/README.md | 7 +++- seed/rust-sdk/unions/src/core/http_client.rs | 6 ++- seed/rust-sdk/unknown/README.md | 7 +++- seed/rust-sdk/unknown/src/core/http_client.rs | 6 ++- seed/rust-sdk/url-form-encoded/README.md | 7 +++- .../url-form-encoded/src/core/http_client.rs | 6 ++- seed/rust-sdk/validation/README.md | 7 +++- .../validation/src/core/http_client.rs | 6 ++- seed/rust-sdk/variables/README.md | 7 +++- .../variables/src/core/http_client.rs | 6 ++- seed/rust-sdk/version-no-default/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- seed/rust-sdk/version/README.md | 7 +++- seed/rust-sdk/version/src/core/http_client.rs | 6 ++- .../webhook-audience/src/core/http_client.rs | 6 ++- .../rust-sdk/webhooks/src/core/http_client.rs | 6 ++- .../src/core/http_client.rs | 6 ++- .../websocket-inferred-auth/README.md | 7 +++- .../src/core/http_client.rs | 6 ++- .../src/core/http_client.rs | 6 ++- .../websocket/src/core/http_client.rs | 1 - seed/rust-sdk/x-fern-default/README.md | 7 +++- .../x-fern-default/src/core/http_client.rs | 6 ++- 246 files changed, 1280 insertions(+), 371 deletions(-) diff --git a/seed/rust-sdk/accept-header/README.md b/seed/rust-sdk/accept-header/README.md index e45f71b17f81..02c0cff2c8b8 100644 --- a/seed/rust-sdk/accept-header/README.md +++ b/seed/rust-sdk/accept-header/README.md @@ -85,7 +85,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/accept-header/src/core/http_client.rs b/seed/rust-sdk/accept-header/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/accept-header/src/core/http_client.rs +++ b/seed/rust-sdk/accept-header/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/alias-extends/README.md b/seed/rust-sdk/alias-extends/README.md index 19ab6aa8f6d4..d0400de3f240 100644 --- a/seed/rust-sdk/alias-extends/README.md +++ b/seed/rust-sdk/alias-extends/README.md @@ -105,7 +105,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/alias-extends/src/core/http_client.rs b/seed/rust-sdk/alias-extends/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/alias-extends/src/core/http_client.rs +++ b/seed/rust-sdk/alias-extends/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/alias/README.md b/seed/rust-sdk/alias/README.md index ddc7db9fadf2..c5d5d724961b 100644 --- a/seed/rust-sdk/alias/README.md +++ b/seed/rust-sdk/alias/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/alias/src/core/http_client.rs b/seed/rust-sdk/alias/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/alias/src/core/http_client.rs +++ b/seed/rust-sdk/alias/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/allof-inline/README.md b/seed/rust-sdk/allof-inline/README.md index 73c2a4769236..a8e8b0a5c52a 100644 --- a/seed/rust-sdk/allof-inline/README.md +++ b/seed/rust-sdk/allof-inline/README.md @@ -120,7 +120,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/allof-inline/src/core/http_client.rs b/seed/rust-sdk/allof-inline/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/allof-inline/src/core/http_client.rs +++ b/seed/rust-sdk/allof-inline/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/allof/README.md b/seed/rust-sdk/allof/README.md index 73c2a4769236..a8e8b0a5c52a 100644 --- a/seed/rust-sdk/allof/README.md +++ b/seed/rust-sdk/allof/README.md @@ -120,7 +120,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/allof/src/core/http_client.rs b/seed/rust-sdk/allof/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/allof/src/core/http_client.rs +++ b/seed/rust-sdk/allof/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/any-auth/README.md b/seed/rust-sdk/any-auth/README.md index b4d2c5036f63..37149fc847ed 100644 --- a/seed/rust-sdk/any-auth/README.md +++ b/seed/rust-sdk/any-auth/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/any-auth/src/core/http_client.rs b/seed/rust-sdk/any-auth/src/core/http_client.rs index e1b4af18ee40..6e93bb8fd512 100644 --- a/seed/rust-sdk/any-auth/src/core/http_client.rs +++ b/seed/rust-sdk/any-auth/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/api-wide-base-path/README.md b/seed/rust-sdk/api-wide-base-path/README.md index c8479655de47..ac232dadf217 100644 --- a/seed/rust-sdk/api-wide-base-path/README.md +++ b/seed/rust-sdk/api-wide-base-path/README.md @@ -93,7 +93,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/api-wide-base-path/src/core/http_client.rs b/seed/rust-sdk/api-wide-base-path/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/api-wide-base-path/src/core/http_client.rs +++ b/seed/rust-sdk/api-wide-base-path/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/audiences/README.md b/seed/rust-sdk/audiences/README.md index 99680ce2207d..e4334607ccfa 100644 --- a/seed/rust-sdk/audiences/README.md +++ b/seed/rust-sdk/audiences/README.md @@ -122,7 +122,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/audiences/src/core/http_client.rs b/seed/rust-sdk/audiences/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/audiences/src/core/http_client.rs +++ b/seed/rust-sdk/audiences/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/basic-auth-environment-variables/README.md b/seed/rust-sdk/basic-auth-environment-variables/README.md index 61e8bac90afd..7c2c88a247d2 100644 --- a/seed/rust-sdk/basic-auth-environment-variables/README.md +++ b/seed/rust-sdk/basic-auth-environment-variables/README.md @@ -89,7 +89,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/basic-auth-environment-variables/src/core/http_client.rs b/seed/rust-sdk/basic-auth-environment-variables/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/basic-auth-environment-variables/src/core/http_client.rs +++ b/seed/rust-sdk/basic-auth-environment-variables/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/basic-auth-pw-omitted/README.md b/seed/rust-sdk/basic-auth-pw-omitted/README.md index 1c8caa21f72e..62c73f6b2fc3 100644 --- a/seed/rust-sdk/basic-auth-pw-omitted/README.md +++ b/seed/rust-sdk/basic-auth-pw-omitted/README.md @@ -89,7 +89,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/basic-auth-pw-omitted/src/core/http_client.rs b/seed/rust-sdk/basic-auth-pw-omitted/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/basic-auth-pw-omitted/src/core/http_client.rs +++ b/seed/rust-sdk/basic-auth-pw-omitted/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/basic-auth/README.md b/seed/rust-sdk/basic-auth/README.md index f1a8197a05f3..fbe019d16ddd 100644 --- a/seed/rust-sdk/basic-auth/README.md +++ b/seed/rust-sdk/basic-auth/README.md @@ -89,7 +89,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/basic-auth/src/core/http_client.rs b/seed/rust-sdk/basic-auth/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/basic-auth/src/core/http_client.rs +++ b/seed/rust-sdk/basic-auth/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/bearer-token-environment-variable/README.md b/seed/rust-sdk/bearer-token-environment-variable/README.md index 1193e67ab4fe..04ab1c1db887 100644 --- a/seed/rust-sdk/bearer-token-environment-variable/README.md +++ b/seed/rust-sdk/bearer-token-environment-variable/README.md @@ -85,7 +85,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/bearer-token-environment-variable/src/core/http_client.rs b/seed/rust-sdk/bearer-token-environment-variable/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/bearer-token-environment-variable/src/core/http_client.rs +++ b/seed/rust-sdk/bearer-token-environment-variable/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/bytes-download/README.md b/seed/rust-sdk/bytes-download/README.md index 1dc9dff69456..4d8b0537f632 100644 --- a/seed/rust-sdk/bytes-download/README.md +++ b/seed/rust-sdk/bytes-download/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/bytes-download/src/core/http_client.rs b/seed/rust-sdk/bytes-download/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/bytes-download/src/core/http_client.rs +++ b/seed/rust-sdk/bytes-download/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/bytes-upload/README.md b/seed/rust-sdk/bytes-upload/README.md index 2cb1bc33ad86..d904d9a8bb86 100644 --- a/seed/rust-sdk/bytes-upload/README.md +++ b/seed/rust-sdk/bytes-upload/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/bytes-upload/src/core/http_client.rs b/seed/rust-sdk/bytes-upload/src/core/http_client.rs index 582c3247a471..344b43cf2f96 100644 --- a/seed/rust-sdk/bytes-upload/src/core/http_client.rs +++ b/seed/rust-sdk/bytes-upload/src/core/http_client.rs @@ -491,8 +491,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/circular-references-advanced/src/core/http_client.rs b/seed/rust-sdk/circular-references-advanced/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/circular-references-advanced/src/core/http_client.rs +++ b/seed/rust-sdk/circular-references-advanced/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/circular-references-extends/src/core/http_client.rs b/seed/rust-sdk/circular-references-extends/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/circular-references-extends/src/core/http_client.rs +++ b/seed/rust-sdk/circular-references-extends/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/circular-references/src/core/http_client.rs b/seed/rust-sdk/circular-references/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/circular-references/src/core/http_client.rs +++ b/seed/rust-sdk/circular-references/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/client-side-params/README.md b/seed/rust-sdk/client-side-params/README.md index 286ffea4d72d..d7afb25a9e14 100644 --- a/seed/rust-sdk/client-side-params/README.md +++ b/seed/rust-sdk/client-side-params/README.md @@ -112,7 +112,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/client-side-params/src/core/http_client.rs b/seed/rust-sdk/client-side-params/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/client-side-params/src/core/http_client.rs +++ b/seed/rust-sdk/client-side-params/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/content-type/README.md b/seed/rust-sdk/content-type/README.md index 7b0663262d93..523bfb7726a4 100644 --- a/seed/rust-sdk/content-type/README.md +++ b/seed/rust-sdk/content-type/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/content-type/src/core/http_client.rs b/seed/rust-sdk/content-type/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/content-type/src/core/http_client.rs +++ b/seed/rust-sdk/content-type/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/cross-package-type-names/README.md b/seed/rust-sdk/cross-package-type-names/README.md index 91b48de9bc81..733b646909f0 100644 --- a/seed/rust-sdk/cross-package-type-names/README.md +++ b/seed/rust-sdk/cross-package-type-names/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/cross-package-type-names/src/core/http_client.rs b/seed/rust-sdk/cross-package-type-names/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/cross-package-type-names/src/core/http_client.rs +++ b/seed/rust-sdk/cross-package-type-names/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/dollar-string-examples/src/core/http_client.rs b/seed/rust-sdk/dollar-string-examples/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/dollar-string-examples/src/core/http_client.rs +++ b/seed/rust-sdk/dollar-string-examples/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/empty-clients/src/core/http_client.rs b/seed/rust-sdk/empty-clients/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/empty-clients/src/core/http_client.rs +++ b/seed/rust-sdk/empty-clients/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/endpoint-security-auth/README.md b/seed/rust-sdk/endpoint-security-auth/README.md index 9480fd0ccdfe..a227daebb723 100644 --- a/seed/rust-sdk/endpoint-security-auth/README.md +++ b/seed/rust-sdk/endpoint-security-auth/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/endpoint-security-auth/src/core/http_client.rs b/seed/rust-sdk/endpoint-security-auth/src/core/http_client.rs index e1b4af18ee40..6e93bb8fd512 100644 --- a/seed/rust-sdk/endpoint-security-auth/src/core/http_client.rs +++ b/seed/rust-sdk/endpoint-security-auth/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/enum/README.md b/seed/rust-sdk/enum/README.md index 30e64db90c60..566bcde53e1f 100644 --- a/seed/rust-sdk/enum/README.md +++ b/seed/rust-sdk/enum/README.md @@ -105,7 +105,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/enum/src/core/http_client.rs b/seed/rust-sdk/enum/src/core/http_client.rs index 4c80d717b193..896111ac77a3 100644 --- a/seed/rust-sdk/enum/src/core/http_client.rs +++ b/seed/rust-sdk/enum/src/core/http_client.rs @@ -521,8 +521,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/error-property/README.md b/seed/rust-sdk/error-property/README.md index 5f5cc21511be..4ee975689ee0 100644 --- a/seed/rust-sdk/error-property/README.md +++ b/seed/rust-sdk/error-property/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/error-property/src/core/http_client.rs b/seed/rust-sdk/error-property/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/error-property/src/core/http_client.rs +++ b/seed/rust-sdk/error-property/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/errors/README.md b/seed/rust-sdk/errors/README.md index 248746f44064..4e4d662e110d 100644 --- a/seed/rust-sdk/errors/README.md +++ b/seed/rust-sdk/errors/README.md @@ -93,7 +93,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/errors/src/core/http_client.rs b/seed/rust-sdk/errors/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/errors/src/core/http_client.rs +++ b/seed/rust-sdk/errors/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/examples/no-custom-config/README.md b/seed/rust-sdk/examples/no-custom-config/README.md index f3d88100a220..44155193a400 100644 --- a/seed/rust-sdk/examples/no-custom-config/README.md +++ b/seed/rust-sdk/examples/no-custom-config/README.md @@ -102,7 +102,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/examples/no-custom-config/src/core/http_client.rs b/seed/rust-sdk/examples/no-custom-config/src/core/http_client.rs index b6edac28fbb9..cba28817b1ed 100644 --- a/seed/rust-sdk/examples/no-custom-config/src/core/http_client.rs +++ b/seed/rust-sdk/examples/no-custom-config/src/core/http_client.rs @@ -453,8 +453,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/examples/readme-config/README.md b/seed/rust-sdk/examples/readme-config/README.md index cefc1de1cdf3..58762c010f9e 100644 --- a/seed/rust-sdk/examples/readme-config/README.md +++ b/seed/rust-sdk/examples/readme-config/README.md @@ -149,7 +149,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/examples/readme-config/src/core/http_client.rs b/seed/rust-sdk/examples/readme-config/src/core/http_client.rs index b6edac28fbb9..cba28817b1ed 100644 --- a/seed/rust-sdk/examples/readme-config/src/core/http_client.rs +++ b/seed/rust-sdk/examples/readme-config/src/core/http_client.rs @@ -453,8 +453,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/exhaustive/README.md b/seed/rust-sdk/exhaustive/README.md index cc249d29dad2..21aa88d02058 100644 --- a/seed/rust-sdk/exhaustive/README.md +++ b/seed/rust-sdk/exhaustive/README.md @@ -102,7 +102,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/exhaustive/src/core/http_client.rs b/seed/rust-sdk/exhaustive/src/core/http_client.rs index f04ed40c4be0..76baf185cc1e 100644 --- a/seed/rust-sdk/exhaustive/src/core/http_client.rs +++ b/seed/rust-sdk/exhaustive/src/core/http_client.rs @@ -493,8 +493,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/extends/README.md b/seed/rust-sdk/extends/README.md index 64a91efae375..542c154c3e7c 100644 --- a/seed/rust-sdk/extends/README.md +++ b/seed/rust-sdk/extends/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/extends/src/core/http_client.rs b/seed/rust-sdk/extends/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/extends/src/core/http_client.rs +++ b/seed/rust-sdk/extends/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/extra-properties/README.md b/seed/rust-sdk/extra-properties/README.md index 57c2ada1e784..fa09e855dfb3 100644 --- a/seed/rust-sdk/extra-properties/README.md +++ b/seed/rust-sdk/extra-properties/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/extra-properties/src/core/http_client.rs b/seed/rust-sdk/extra-properties/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/extra-properties/src/core/http_client.rs +++ b/seed/rust-sdk/extra-properties/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/file-download/README.md b/seed/rust-sdk/file-download/README.md index 5c9630cc0aaf..fc7547cee7f4 100644 --- a/seed/rust-sdk/file-download/README.md +++ b/seed/rust-sdk/file-download/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/file-download/src/core/http_client.rs b/seed/rust-sdk/file-download/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/file-download/src/core/http_client.rs +++ b/seed/rust-sdk/file-download/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/file-upload-openapi/README.md b/seed/rust-sdk/file-upload-openapi/README.md index ec5ebb46d4f6..da394c84f7ee 100644 --- a/seed/rust-sdk/file-upload-openapi/README.md +++ b/seed/rust-sdk/file-upload-openapi/README.md @@ -93,7 +93,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/file-upload-openapi/src/core/http_client.rs b/seed/rust-sdk/file-upload-openapi/src/core/http_client.rs index 4c80d717b193..896111ac77a3 100644 --- a/seed/rust-sdk/file-upload-openapi/src/core/http_client.rs +++ b/seed/rust-sdk/file-upload-openapi/src/core/http_client.rs @@ -521,8 +521,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/file-upload/README.md b/seed/rust-sdk/file-upload/README.md index 759578bb64f1..c7de1823889e 100644 --- a/seed/rust-sdk/file-upload/README.md +++ b/seed/rust-sdk/file-upload/README.md @@ -92,7 +92,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/file-upload/src/core/http_client.rs b/seed/rust-sdk/file-upload/src/core/http_client.rs index 4c80d717b193..896111ac77a3 100644 --- a/seed/rust-sdk/file-upload/src/core/http_client.rs +++ b/seed/rust-sdk/file-upload/src/core/http_client.rs @@ -521,8 +521,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/folders/README.md b/seed/rust-sdk/folders/README.md index 86c1a6997209..179f276f3650 100644 --- a/seed/rust-sdk/folders/README.md +++ b/seed/rust-sdk/folders/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/folders/src/core/http_client.rs b/seed/rust-sdk/folders/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/folders/src/core/http_client.rs +++ b/seed/rust-sdk/folders/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/header-auth-environment-variable/README.md b/seed/rust-sdk/header-auth-environment-variable/README.md index 6f1f790c0390..5d7f3a64396d 100644 --- a/seed/rust-sdk/header-auth-environment-variable/README.md +++ b/seed/rust-sdk/header-auth-environment-variable/README.md @@ -85,7 +85,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/header-auth-environment-variable/src/core/http_client.rs b/seed/rust-sdk/header-auth-environment-variable/src/core/http_client.rs index 61ac801041a7..5b9edab16123 100644 --- a/seed/rust-sdk/header-auth-environment-variable/src/core/http_client.rs +++ b/seed/rust-sdk/header-auth-environment-variable/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/header-auth/README.md b/seed/rust-sdk/header-auth/README.md index b482e4f381a2..4727f23baed2 100644 --- a/seed/rust-sdk/header-auth/README.md +++ b/seed/rust-sdk/header-auth/README.md @@ -85,7 +85,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/header-auth/src/core/http_client.rs b/seed/rust-sdk/header-auth/src/core/http_client.rs index 61ac801041a7..5b9edab16123 100644 --- a/seed/rust-sdk/header-auth/src/core/http_client.rs +++ b/seed/rust-sdk/header-auth/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/http-head/README.md b/seed/rust-sdk/http-head/README.md index 6ae70095b6cc..0fe141c58b17 100644 --- a/seed/rust-sdk/http-head/README.md +++ b/seed/rust-sdk/http-head/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/http-head/src/core/http_client.rs b/seed/rust-sdk/http-head/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/http-head/src/core/http_client.rs +++ b/seed/rust-sdk/http-head/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/idempotency-headers/README.md b/seed/rust-sdk/idempotency-headers/README.md index 5defd0301dca..627d664743ae 100644 --- a/seed/rust-sdk/idempotency-headers/README.md +++ b/seed/rust-sdk/idempotency-headers/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/idempotency-headers/src/core/http_client.rs b/seed/rust-sdk/idempotency-headers/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/idempotency-headers/src/core/http_client.rs +++ b/seed/rust-sdk/idempotency-headers/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/imdb/imdb-custom-config/README.md b/seed/rust-sdk/imdb/imdb-custom-config/README.md index 777875f7779c..ac5694ac347d 100644 --- a/seed/rust-sdk/imdb/imdb-custom-config/README.md +++ b/seed/rust-sdk/imdb/imdb-custom-config/README.md @@ -95,7 +95,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/imdb/imdb-custom-config/src/core/http_client.rs b/seed/rust-sdk/imdb/imdb-custom-config/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/imdb/imdb-custom-config/src/core/http_client.rs +++ b/seed/rust-sdk/imdb/imdb-custom-config/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/imdb/imdb-custom-features/README.md b/seed/rust-sdk/imdb/imdb-custom-features/README.md index c374b1a9d097..a071339f5881 100644 --- a/seed/rust-sdk/imdb/imdb-custom-features/README.md +++ b/seed/rust-sdk/imdb/imdb-custom-features/README.md @@ -95,7 +95,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/imdb/imdb-custom-features/src/core/http_client.rs b/seed/rust-sdk/imdb/imdb-custom-features/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/imdb/imdb-custom-features/src/core/http_client.rs +++ b/seed/rust-sdk/imdb/imdb-custom-features/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/imdb/imdb/README.md b/seed/rust-sdk/imdb/imdb/README.md index c374b1a9d097..a071339f5881 100644 --- a/seed/rust-sdk/imdb/imdb/README.md +++ b/seed/rust-sdk/imdb/imdb/README.md @@ -95,7 +95,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/imdb/imdb/src/core/http_client.rs b/seed/rust-sdk/imdb/imdb/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/imdb/imdb/src/core/http_client.rs +++ b/seed/rust-sdk/imdb/imdb/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/inferred-auth-explicit/README.md b/seed/rust-sdk/inferred-auth-explicit/README.md index 301db3f60b4b..70548eea7a6a 100644 --- a/seed/rust-sdk/inferred-auth-explicit/README.md +++ b/seed/rust-sdk/inferred-auth-explicit/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/inferred-auth-explicit/src/core/http_client.rs b/seed/rust-sdk/inferred-auth-explicit/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/inferred-auth-explicit/src/core/http_client.rs +++ b/seed/rust-sdk/inferred-auth-explicit/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/inferred-auth-implicit-api-key/README.md b/seed/rust-sdk/inferred-auth-implicit-api-key/README.md index db288b9f3383..a078311574fb 100644 --- a/seed/rust-sdk/inferred-auth-implicit-api-key/README.md +++ b/seed/rust-sdk/inferred-auth-implicit-api-key/README.md @@ -89,7 +89,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/inferred-auth-implicit-api-key/src/core/http_client.rs b/seed/rust-sdk/inferred-auth-implicit-api-key/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/inferred-auth-implicit-api-key/src/core/http_client.rs +++ b/seed/rust-sdk/inferred-auth-implicit-api-key/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/inferred-auth-implicit-no-expiry/README.md b/seed/rust-sdk/inferred-auth-implicit-no-expiry/README.md index a802b4498328..b46dbd8ca9de 100644 --- a/seed/rust-sdk/inferred-auth-implicit-no-expiry/README.md +++ b/seed/rust-sdk/inferred-auth-implicit-no-expiry/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/inferred-auth-implicit-no-expiry/src/core/http_client.rs b/seed/rust-sdk/inferred-auth-implicit-no-expiry/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/inferred-auth-implicit-no-expiry/src/core/http_client.rs +++ b/seed/rust-sdk/inferred-auth-implicit-no-expiry/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/inferred-auth-implicit-reference/README.md b/seed/rust-sdk/inferred-auth-implicit-reference/README.md index 7af37dcbf578..5daf4bfaf862 100644 --- a/seed/rust-sdk/inferred-auth-implicit-reference/README.md +++ b/seed/rust-sdk/inferred-auth-implicit-reference/README.md @@ -96,7 +96,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/inferred-auth-implicit-reference/src/core/http_client.rs b/seed/rust-sdk/inferred-auth-implicit-reference/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/inferred-auth-implicit-reference/src/core/http_client.rs +++ b/seed/rust-sdk/inferred-auth-implicit-reference/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/inferred-auth-implicit/README.md b/seed/rust-sdk/inferred-auth-implicit/README.md index df4e91f3f848..c54dd0879001 100644 --- a/seed/rust-sdk/inferred-auth-implicit/README.md +++ b/seed/rust-sdk/inferred-auth-implicit/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/inferred-auth-implicit/src/core/http_client.rs b/seed/rust-sdk/inferred-auth-implicit/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/inferred-auth-implicit/src/core/http_client.rs +++ b/seed/rust-sdk/inferred-auth-implicit/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/license/basic/README.md b/seed/rust-sdk/license/basic/README.md index 1d316ab62b28..34b61e56f011 100644 --- a/seed/rust-sdk/license/basic/README.md +++ b/seed/rust-sdk/license/basic/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/license/basic/src/core/http_client.rs b/seed/rust-sdk/license/basic/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/license/basic/src/core/http_client.rs +++ b/seed/rust-sdk/license/basic/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/license/both-license-options/README.md b/seed/rust-sdk/license/both-license-options/README.md index 1d316ab62b28..34b61e56f011 100644 --- a/seed/rust-sdk/license/both-license-options/README.md +++ b/seed/rust-sdk/license/both-license-options/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/license/both-license-options/src/core/http_client.rs b/seed/rust-sdk/license/both-license-options/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/license/both-license-options/src/core/http_client.rs +++ b/seed/rust-sdk/license/both-license-options/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/license/custom-license-file/README.md b/seed/rust-sdk/license/custom-license-file/README.md index 1d316ab62b28..34b61e56f011 100644 --- a/seed/rust-sdk/license/custom-license-file/README.md +++ b/seed/rust-sdk/license/custom-license-file/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/license/custom-license-file/src/core/http_client.rs b/seed/rust-sdk/license/custom-license-file/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/license/custom-license-file/src/core/http_client.rs +++ b/seed/rust-sdk/license/custom-license-file/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/license/empty-license-file/README.md b/seed/rust-sdk/license/empty-license-file/README.md index 1d316ab62b28..34b61e56f011 100644 --- a/seed/rust-sdk/license/empty-license-file/README.md +++ b/seed/rust-sdk/license/empty-license-file/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/license/empty-license-file/src/core/http_client.rs b/seed/rust-sdk/license/empty-license-file/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/license/empty-license-file/src/core/http_client.rs +++ b/seed/rust-sdk/license/empty-license-file/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/literal/README.md b/seed/rust-sdk/literal/README.md index e3817b717f4b..3124cf5984a8 100644 --- a/seed/rust-sdk/literal/README.md +++ b/seed/rust-sdk/literal/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/literal/src/core/http_client.rs b/seed/rust-sdk/literal/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/literal/src/core/http_client.rs +++ b/seed/rust-sdk/literal/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/literals-unions/src/core/http_client.rs b/seed/rust-sdk/literals-unions/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/literals-unions/src/core/http_client.rs +++ b/seed/rust-sdk/literals-unions/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/mixed-case/README.md b/seed/rust-sdk/mixed-case/README.md index 8448e3a1569e..2aefbf71524c 100644 --- a/seed/rust-sdk/mixed-case/README.md +++ b/seed/rust-sdk/mixed-case/README.md @@ -87,7 +87,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/mixed-case/src/core/http_client.rs b/seed/rust-sdk/mixed-case/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/mixed-case/src/core/http_client.rs +++ b/seed/rust-sdk/mixed-case/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/mixed-file-directory/README.md b/seed/rust-sdk/mixed-file-directory/README.md index 13f6a8914bb2..626d1eff59ea 100644 --- a/seed/rust-sdk/mixed-file-directory/README.md +++ b/seed/rust-sdk/mixed-file-directory/README.md @@ -93,7 +93,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/mixed-file-directory/src/core/http_client.rs b/seed/rust-sdk/mixed-file-directory/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/mixed-file-directory/src/core/http_client.rs +++ b/seed/rust-sdk/mixed-file-directory/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/multi-line-docs/README.md b/seed/rust-sdk/multi-line-docs/README.md index 87c03b179784..0752541e42a4 100644 --- a/seed/rust-sdk/multi-line-docs/README.md +++ b/seed/rust-sdk/multi-line-docs/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/multi-line-docs/src/core/http_client.rs b/seed/rust-sdk/multi-line-docs/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/multi-line-docs/src/core/http_client.rs +++ b/seed/rust-sdk/multi-line-docs/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/multi-url-environment-no-default/README.md b/seed/rust-sdk/multi-url-environment-no-default/README.md index 462ce7df5d64..486a5f310bcc 100644 --- a/seed/rust-sdk/multi-url-environment-no-default/README.md +++ b/seed/rust-sdk/multi-url-environment-no-default/README.md @@ -121,7 +121,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/multi-url-environment-no-default/src/core/http_client.rs b/seed/rust-sdk/multi-url-environment-no-default/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/multi-url-environment-no-default/src/core/http_client.rs +++ b/seed/rust-sdk/multi-url-environment-no-default/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/multi-url-environment-reference/README.md b/seed/rust-sdk/multi-url-environment-reference/README.md index 237c950abf25..4b04f5c47bec 100644 --- a/seed/rust-sdk/multi-url-environment-reference/README.md +++ b/seed/rust-sdk/multi-url-environment-reference/README.md @@ -122,7 +122,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/multi-url-environment-reference/src/core/http_client.rs b/seed/rust-sdk/multi-url-environment-reference/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/multi-url-environment-reference/src/core/http_client.rs +++ b/seed/rust-sdk/multi-url-environment-reference/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/multi-url-environment/README.md b/seed/rust-sdk/multi-url-environment/README.md index efa7cf183d74..8df5bcf93c3a 100644 --- a/seed/rust-sdk/multi-url-environment/README.md +++ b/seed/rust-sdk/multi-url-environment/README.md @@ -121,7 +121,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/multi-url-environment/src/core/http_client.rs b/seed/rust-sdk/multi-url-environment/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/multi-url-environment/src/core/http_client.rs +++ b/seed/rust-sdk/multi-url-environment/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/multiple-request-bodies/README.md b/seed/rust-sdk/multiple-request-bodies/README.md index 926401edb0fe..ac4f2b3c9183 100644 --- a/seed/rust-sdk/multiple-request-bodies/README.md +++ b/seed/rust-sdk/multiple-request-bodies/README.md @@ -120,7 +120,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/multiple-request-bodies/src/core/http_client.rs b/seed/rust-sdk/multiple-request-bodies/src/core/http_client.rs index 582c3247a471..344b43cf2f96 100644 --- a/seed/rust-sdk/multiple-request-bodies/src/core/http_client.rs +++ b/seed/rust-sdk/multiple-request-bodies/src/core/http_client.rs @@ -491,8 +491,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/no-content-response/README.md b/seed/rust-sdk/no-content-response/README.md index 9f3cad31ce31..9938f49c9e5f 100644 --- a/seed/rust-sdk/no-content-response/README.md +++ b/seed/rust-sdk/no-content-response/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/no-content-response/src/core/http_client.rs b/seed/rust-sdk/no-content-response/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/no-content-response/src/core/http_client.rs +++ b/seed/rust-sdk/no-content-response/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/no-environment/README.md b/seed/rust-sdk/no-environment/README.md index e9f40ec4b868..302ed74e8ce5 100644 --- a/seed/rust-sdk/no-environment/README.md +++ b/seed/rust-sdk/no-environment/README.md @@ -85,7 +85,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/no-environment/src/core/http_client.rs b/seed/rust-sdk/no-environment/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/no-environment/src/core/http_client.rs +++ b/seed/rust-sdk/no-environment/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/no-retries/README.md b/seed/rust-sdk/no-retries/README.md index 8c11651a44e4..78bada100d9c 100644 --- a/seed/rust-sdk/no-retries/README.md +++ b/seed/rust-sdk/no-retries/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/no-retries/src/core/http_client.rs b/seed/rust-sdk/no-retries/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/no-retries/src/core/http_client.rs +++ b/seed/rust-sdk/no-retries/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/null-type/README.md b/seed/rust-sdk/null-type/README.md index 830c8a63ca4c..df7c93e1e098 100644 --- a/seed/rust-sdk/null-type/README.md +++ b/seed/rust-sdk/null-type/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/null-type/src/core/http_client.rs b/seed/rust-sdk/null-type/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/null-type/src/core/http_client.rs +++ b/seed/rust-sdk/null-type/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/nullable-allof-extends/README.md b/seed/rust-sdk/nullable-allof-extends/README.md index 8f59f0ab4a02..19f9f1f01671 100644 --- a/seed/rust-sdk/nullable-allof-extends/README.md +++ b/seed/rust-sdk/nullable-allof-extends/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/nullable-allof-extends/src/core/http_client.rs b/seed/rust-sdk/nullable-allof-extends/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/nullable-allof-extends/src/core/http_client.rs +++ b/seed/rust-sdk/nullable-allof-extends/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/nullable-optional/README.md b/seed/rust-sdk/nullable-optional/README.md index 51324ac7bc97..1b7575a63726 100644 --- a/seed/rust-sdk/nullable-optional/README.md +++ b/seed/rust-sdk/nullable-optional/README.md @@ -118,7 +118,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/nullable-optional/src/core/http_client.rs b/seed/rust-sdk/nullable-optional/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/nullable-optional/src/core/http_client.rs +++ b/seed/rust-sdk/nullable-optional/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/nullable-request-body/README.md b/seed/rust-sdk/nullable-request-body/README.md index 3624f586e630..0de583a8d5cb 100644 --- a/seed/rust-sdk/nullable-request-body/README.md +++ b/seed/rust-sdk/nullable-request-body/README.md @@ -96,7 +96,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/nullable-request-body/src/core/http_client.rs b/seed/rust-sdk/nullable-request-body/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/nullable-request-body/src/core/http_client.rs +++ b/seed/rust-sdk/nullable-request-body/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/nullable/README.md b/seed/rust-sdk/nullable/README.md index 77cca5dc63ab..50ee819e5505 100644 --- a/seed/rust-sdk/nullable/README.md +++ b/seed/rust-sdk/nullable/README.md @@ -118,7 +118,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/nullable/src/core/http_client.rs b/seed/rust-sdk/nullable/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/nullable/src/core/http_client.rs +++ b/seed/rust-sdk/nullable/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/oauth-client-credentials-custom/README.md b/seed/rust-sdk/oauth-client-credentials-custom/README.md index 8316d1fbaa1c..2878be924f5a 100644 --- a/seed/rust-sdk/oauth-client-credentials-custom/README.md +++ b/seed/rust-sdk/oauth-client-credentials-custom/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/oauth-client-credentials-custom/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-custom/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/oauth-client-credentials-custom/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-custom/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/oauth-client-credentials-default/README.md b/seed/rust-sdk/oauth-client-credentials-default/README.md index 7508c5393183..44197c982aae 100644 --- a/seed/rust-sdk/oauth-client-credentials-default/README.md +++ b/seed/rust-sdk/oauth-client-credentials-default/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/oauth-client-credentials-default/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-default/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/oauth-client-credentials-default/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-default/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/oauth-client-credentials-environment-variables/README.md b/seed/rust-sdk/oauth-client-credentials-environment-variables/README.md index 6e38b58c17ad..3c662542f008 100644 --- a/seed/rust-sdk/oauth-client-credentials-environment-variables/README.md +++ b/seed/rust-sdk/oauth-client-credentials-environment-variables/README.md @@ -110,7 +110,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/oauth-client-credentials-environment-variables/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-environment-variables/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/oauth-client-credentials-environment-variables/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-environment-variables/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/oauth-client-credentials-mandatory-auth/README.md b/seed/rust-sdk/oauth-client-credentials-mandatory-auth/README.md index b5041e75dacc..f44cfbbcaf26 100644 --- a/seed/rust-sdk/oauth-client-credentials-mandatory-auth/README.md +++ b/seed/rust-sdk/oauth-client-credentials-mandatory-auth/README.md @@ -110,7 +110,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/oauth-client-credentials-mandatory-auth/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-mandatory-auth/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/oauth-client-credentials-mandatory-auth/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-mandatory-auth/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/oauth-client-credentials-nested-root/README.md b/seed/rust-sdk/oauth-client-credentials-nested-root/README.md index 4587373992dc..c58844ca226c 100644 --- a/seed/rust-sdk/oauth-client-credentials-nested-root/README.md +++ b/seed/rust-sdk/oauth-client-credentials-nested-root/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/oauth-client-credentials-nested-root/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-nested-root/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/oauth-client-credentials-nested-root/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-nested-root/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/oauth-client-credentials-openapi/README.md b/seed/rust-sdk/oauth-client-credentials-openapi/README.md index 2052a5de5515..09ec9f475f99 100644 --- a/seed/rust-sdk/oauth-client-credentials-openapi/README.md +++ b/seed/rust-sdk/oauth-client-credentials-openapi/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/oauth-client-credentials-openapi/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-openapi/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/oauth-client-credentials-openapi/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-openapi/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/oauth-client-credentials-reference/README.md b/seed/rust-sdk/oauth-client-credentials-reference/README.md index 9aa648b49a01..e461db74d896 100644 --- a/seed/rust-sdk/oauth-client-credentials-reference/README.md +++ b/seed/rust-sdk/oauth-client-credentials-reference/README.md @@ -95,7 +95,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/oauth-client-credentials-reference/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-reference/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/oauth-client-credentials-reference/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-reference/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/oauth-client-credentials-with-variables/README.md b/seed/rust-sdk/oauth-client-credentials-with-variables/README.md index e22e3fc61513..1842f863d7ef 100644 --- a/seed/rust-sdk/oauth-client-credentials-with-variables/README.md +++ b/seed/rust-sdk/oauth-client-credentials-with-variables/README.md @@ -110,7 +110,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/oauth-client-credentials-with-variables/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials-with-variables/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/oauth-client-credentials-with-variables/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials-with-variables/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/oauth-client-credentials/README.md b/seed/rust-sdk/oauth-client-credentials/README.md index 176ab6acfe53..6012be1820ef 100644 --- a/seed/rust-sdk/oauth-client-credentials/README.md +++ b/seed/rust-sdk/oauth-client-credentials/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/oauth-client-credentials/src/core/http_client.rs b/seed/rust-sdk/oauth-client-credentials/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/oauth-client-credentials/src/core/http_client.rs +++ b/seed/rust-sdk/oauth-client-credentials/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/object/src/core/http_client.rs b/seed/rust-sdk/object/src/core/http_client.rs index b6edac28fbb9..cba28817b1ed 100644 --- a/seed/rust-sdk/object/src/core/http_client.rs +++ b/seed/rust-sdk/object/src/core/http_client.rs @@ -453,8 +453,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/objects-with-imports/src/core/http_client.rs b/seed/rust-sdk/objects-with-imports/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/objects-with-imports/src/core/http_client.rs +++ b/seed/rust-sdk/objects-with-imports/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/openapi-request-body-ref/README.md b/seed/rust-sdk/openapi-request-body-ref/README.md index 940fb3d11295..c5b2a94c9da1 100644 --- a/seed/rust-sdk/openapi-request-body-ref/README.md +++ b/seed/rust-sdk/openapi-request-body-ref/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/openapi-request-body-ref/src/core/http_client.rs b/seed/rust-sdk/openapi-request-body-ref/src/core/http_client.rs index 025d91d81fd0..896111ac77a3 100644 --- a/seed/rust-sdk/openapi-request-body-ref/src/core/http_client.rs +++ b/seed/rust-sdk/openapi-request-body-ref/src/core/http_client.rs @@ -521,6 +521,14 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -539,6 +547,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -767,3 +779,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/optional/README.md b/seed/rust-sdk/optional/README.md index 356879aebb34..8ac322e146f7 100644 --- a/seed/rust-sdk/optional/README.md +++ b/seed/rust-sdk/optional/README.md @@ -93,7 +93,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/optional/src/core/http_client.rs b/seed/rust-sdk/optional/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/optional/src/core/http_client.rs +++ b/seed/rust-sdk/optional/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/package-yml/README.md b/seed/rust-sdk/package-yml/README.md index f777f2e93120..adf7f21a2f28 100644 --- a/seed/rust-sdk/package-yml/README.md +++ b/seed/rust-sdk/package-yml/README.md @@ -94,7 +94,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/package-yml/src/core/http_client.rs b/seed/rust-sdk/package-yml/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/package-yml/src/core/http_client.rs +++ b/seed/rust-sdk/package-yml/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/pagination-custom/README.md b/seed/rust-sdk/pagination-custom/README.md index 6add79460acf..cacfef4eea90 100644 --- a/seed/rust-sdk/pagination-custom/README.md +++ b/seed/rust-sdk/pagination-custom/README.md @@ -95,7 +95,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/pagination-custom/src/core/http_client.rs b/seed/rust-sdk/pagination-custom/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/pagination-custom/src/core/http_client.rs +++ b/seed/rust-sdk/pagination-custom/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/pagination-uri-path/README.md b/seed/rust-sdk/pagination-uri-path/README.md index c93b0b428a34..20cd1c59c9e0 100644 --- a/seed/rust-sdk/pagination-uri-path/README.md +++ b/seed/rust-sdk/pagination-uri-path/README.md @@ -85,7 +85,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/pagination-uri-path/src/core/http_client.rs b/seed/rust-sdk/pagination-uri-path/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/pagination-uri-path/src/core/http_client.rs +++ b/seed/rust-sdk/pagination-uri-path/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/pagination/README.md b/seed/rust-sdk/pagination/README.md index 904ba0a61393..e7776ebcaa2b 100644 --- a/seed/rust-sdk/pagination/README.md +++ b/seed/rust-sdk/pagination/README.md @@ -117,7 +117,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/pagination/src/core/http_client.rs b/seed/rust-sdk/pagination/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/pagination/src/core/http_client.rs +++ b/seed/rust-sdk/pagination/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/path-parameters/README.md b/seed/rust-sdk/path-parameters/README.md index c0289c2f8a14..fbabb9740b54 100644 --- a/seed/rust-sdk/path-parameters/README.md +++ b/seed/rust-sdk/path-parameters/README.md @@ -95,7 +95,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/path-parameters/src/core/http_client.rs b/seed/rust-sdk/path-parameters/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/path-parameters/src/core/http_client.rs +++ b/seed/rust-sdk/path-parameters/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/plain-text/README.md b/seed/rust-sdk/plain-text/README.md index f60b1d8ace67..4796caecf2d2 100644 --- a/seed/rust-sdk/plain-text/README.md +++ b/seed/rust-sdk/plain-text/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/plain-text/src/core/http_client.rs b/seed/rust-sdk/plain-text/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/plain-text/src/core/http_client.rs +++ b/seed/rust-sdk/plain-text/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/property-access/README.md b/seed/rust-sdk/property-access/README.md index cbf14a121f00..4daa63c6589d 100644 --- a/seed/rust-sdk/property-access/README.md +++ b/seed/rust-sdk/property-access/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/property-access/src/core/http_client.rs b/seed/rust-sdk/property-access/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/property-access/src/core/http_client.rs +++ b/seed/rust-sdk/property-access/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/public-object/src/core/http_client.rs b/seed/rust-sdk/public-object/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/public-object/src/core/http_client.rs +++ b/seed/rust-sdk/public-object/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/query-param-name-conflict/README.md b/seed/rust-sdk/query-param-name-conflict/README.md index e00ee985f4b8..d3fbebacbe72 100644 --- a/seed/rust-sdk/query-param-name-conflict/README.md +++ b/seed/rust-sdk/query-param-name-conflict/README.md @@ -104,7 +104,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/query-param-name-conflict/src/core/http_client.rs b/seed/rust-sdk/query-param-name-conflict/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/query-param-name-conflict/src/core/http_client.rs +++ b/seed/rust-sdk/query-param-name-conflict/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/query-parameters-openapi-as-objects/README.md b/seed/rust-sdk/query-parameters-openapi-as-objects/README.md index 67ed9d7509d9..57112377ab67 100644 --- a/seed/rust-sdk/query-parameters-openapi-as-objects/README.md +++ b/seed/rust-sdk/query-parameters-openapi-as-objects/README.md @@ -145,7 +145,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/query-parameters-openapi-as-objects/src/core/http_client.rs b/seed/rust-sdk/query-parameters-openapi-as-objects/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/query-parameters-openapi-as-objects/src/core/http_client.rs +++ b/seed/rust-sdk/query-parameters-openapi-as-objects/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/query-parameters-openapi/README.md b/seed/rust-sdk/query-parameters-openapi/README.md index 67ed9d7509d9..57112377ab67 100644 --- a/seed/rust-sdk/query-parameters-openapi/README.md +++ b/seed/rust-sdk/query-parameters-openapi/README.md @@ -145,7 +145,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/query-parameters-openapi/src/core/http_client.rs b/seed/rust-sdk/query-parameters-openapi/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/query-parameters-openapi/src/core/http_client.rs +++ b/seed/rust-sdk/query-parameters-openapi/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/query-parameters/README.md b/seed/rust-sdk/query-parameters/README.md index 667e21eee660..34f7ba2c6ff8 100644 --- a/seed/rust-sdk/query-parameters/README.md +++ b/seed/rust-sdk/query-parameters/README.md @@ -140,7 +140,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/query-parameters/src/core/http_client.rs b/seed/rust-sdk/query-parameters/src/core/http_client.rs index b6edac28fbb9..cba28817b1ed 100644 --- a/seed/rust-sdk/query-parameters/src/core/http_client.rs +++ b/seed/rust-sdk/query-parameters/src/core/http_client.rs @@ -453,8 +453,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/request-parameters/README.md b/seed/rust-sdk/request-parameters/README.md index 4a4fdb0ccec1..a02a3262acda 100644 --- a/seed/rust-sdk/request-parameters/README.md +++ b/seed/rust-sdk/request-parameters/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/request-parameters/src/core/http_client.rs b/seed/rust-sdk/request-parameters/src/core/http_client.rs index b6edac28fbb9..cba28817b1ed 100644 --- a/seed/rust-sdk/request-parameters/src/core/http_client.rs +++ b/seed/rust-sdk/request-parameters/src/core/http_client.rs @@ -453,8 +453,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/required-nullable/README.md b/seed/rust-sdk/required-nullable/README.md index c07936dafbf8..6be82ead37c6 100644 --- a/seed/rust-sdk/required-nullable/README.md +++ b/seed/rust-sdk/required-nullable/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/required-nullable/src/core/http_client.rs b/seed/rust-sdk/required-nullable/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/required-nullable/src/core/http_client.rs +++ b/seed/rust-sdk/required-nullable/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/reserved-keywords/README.md b/seed/rust-sdk/reserved-keywords/README.md index bded483dcf29..c55e86506ff3 100644 --- a/seed/rust-sdk/reserved-keywords/README.md +++ b/seed/rust-sdk/reserved-keywords/README.md @@ -92,7 +92,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/reserved-keywords/src/core/http_client.rs b/seed/rust-sdk/reserved-keywords/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/reserved-keywords/src/core/http_client.rs +++ b/seed/rust-sdk/reserved-keywords/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/response-property/README.md b/seed/rust-sdk/response-property/README.md index 9453750a0d8a..cce69db8c855 100644 --- a/seed/rust-sdk/response-property/README.md +++ b/seed/rust-sdk/response-property/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/response-property/src/core/http_client.rs b/seed/rust-sdk/response-property/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/response-property/src/core/http_client.rs +++ b/seed/rust-sdk/response-property/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/schemaless-request-body-examples/README.md b/seed/rust-sdk/schemaless-request-body-examples/README.md index d729d6b8118c..53f64fbd5f81 100644 --- a/seed/rust-sdk/schemaless-request-body-examples/README.md +++ b/seed/rust-sdk/schemaless-request-body-examples/README.md @@ -97,7 +97,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/schemaless-request-body-examples/src/core/http_client.rs b/seed/rust-sdk/schemaless-request-body-examples/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/schemaless-request-body-examples/src/core/http_client.rs +++ b/seed/rust-sdk/schemaless-request-body-examples/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/README.md b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/README.md index 70ed49465c4a..b022ac623296 100644 --- a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/README.md +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/README.md @@ -105,7 +105,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/core/http_client.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/core/http_client.rs index dca519ee2ad8..ba0f18c6dffe 100644 --- a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/core/http_client.rs +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/server-sent-events-openapi/README.md b/seed/rust-sdk/server-sent-events-openapi/README.md index 9d5f126234e4..a4ef1a4bb581 100644 --- a/seed/rust-sdk/server-sent-events-openapi/README.md +++ b/seed/rust-sdk/server-sent-events-openapi/README.md @@ -104,7 +104,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/server-sent-events-openapi/src/core/http_client.rs b/seed/rust-sdk/server-sent-events-openapi/src/core/http_client.rs index dca519ee2ad8..ba0f18c6dffe 100644 --- a/seed/rust-sdk/server-sent-events-openapi/src/core/http_client.rs +++ b/seed/rust-sdk/server-sent-events-openapi/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/server-sent-events/with-wire-tests/README.md b/seed/rust-sdk/server-sent-events/with-wire-tests/README.md index 70ed49465c4a..b022ac623296 100644 --- a/seed/rust-sdk/server-sent-events/with-wire-tests/README.md +++ b/seed/rust-sdk/server-sent-events/with-wire-tests/README.md @@ -105,7 +105,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/server-sent-events/with-wire-tests/src/core/http_client.rs b/seed/rust-sdk/server-sent-events/with-wire-tests/src/core/http_client.rs index dca519ee2ad8..ba0f18c6dffe 100644 --- a/seed/rust-sdk/server-sent-events/with-wire-tests/src/core/http_client.rs +++ b/seed/rust-sdk/server-sent-events/with-wire-tests/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/server-url-templating/README.md b/seed/rust-sdk/server-url-templating/README.md index 5e5c00289ba9..59357ea29cd7 100644 --- a/seed/rust-sdk/server-url-templating/README.md +++ b/seed/rust-sdk/server-url-templating/README.md @@ -120,7 +120,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/server-url-templating/src/core/http_client.rs b/seed/rust-sdk/server-url-templating/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/server-url-templating/src/core/http_client.rs +++ b/seed/rust-sdk/server-url-templating/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/simple-api/basic-custom-config/README.md b/seed/rust-sdk/simple-api/basic-custom-config/README.md index 50b2879fb0a3..72521802e6a5 100644 --- a/seed/rust-sdk/simple-api/basic-custom-config/README.md +++ b/seed/rust-sdk/simple-api/basic-custom-config/README.md @@ -100,7 +100,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/simple-api/basic-custom-config/src/core/http_client.rs b/seed/rust-sdk/simple-api/basic-custom-config/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/simple-api/basic-custom-config/src/core/http_client.rs +++ b/seed/rust-sdk/simple-api/basic-custom-config/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/simple-api/basic/README.md b/seed/rust-sdk/simple-api/basic/README.md index 976cdefacc10..8184cc334c0d 100644 --- a/seed/rust-sdk/simple-api/basic/README.md +++ b/seed/rust-sdk/simple-api/basic/README.md @@ -100,7 +100,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/simple-api/basic/src/core/http_client.rs b/seed/rust-sdk/simple-api/basic/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/simple-api/basic/src/core/http_client.rs +++ b/seed/rust-sdk/simple-api/basic/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/simple-fhir/README.md b/seed/rust-sdk/simple-fhir/README.md index 4555a8668942..f578cd6e4d0a 100644 --- a/seed/rust-sdk/simple-fhir/README.md +++ b/seed/rust-sdk/simple-fhir/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/simple-fhir/src/core/http_client.rs b/seed/rust-sdk/simple-fhir/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/simple-fhir/src/core/http_client.rs +++ b/seed/rust-sdk/simple-fhir/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/single-url-environment-default/basic/README.md b/seed/rust-sdk/single-url-environment-default/basic/README.md index c4866d8058c1..3eb951fe2af5 100644 --- a/seed/rust-sdk/single-url-environment-default/basic/README.md +++ b/seed/rust-sdk/single-url-environment-default/basic/README.md @@ -100,7 +100,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/single-url-environment-default/basic/src/core/http_client.rs b/seed/rust-sdk/single-url-environment-default/basic/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/single-url-environment-default/basic/src/core/http_client.rs +++ b/seed/rust-sdk/single-url-environment-default/basic/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/single-url-environment-default/custom-environment/README.md b/seed/rust-sdk/single-url-environment-default/custom-environment/README.md index e2b33ba85d96..e680bd66ac2d 100644 --- a/seed/rust-sdk/single-url-environment-default/custom-environment/README.md +++ b/seed/rust-sdk/single-url-environment-default/custom-environment/README.md @@ -100,7 +100,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/single-url-environment-default/custom-environment/src/core/http_client.rs b/seed/rust-sdk/single-url-environment-default/custom-environment/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/single-url-environment-default/custom-environment/src/core/http_client.rs +++ b/seed/rust-sdk/single-url-environment-default/custom-environment/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/single-url-environment-default/full-custom/README.md b/seed/rust-sdk/single-url-environment-default/full-custom/README.md index a422ae2e7239..b6f78faff500 100644 --- a/seed/rust-sdk/single-url-environment-default/full-custom/README.md +++ b/seed/rust-sdk/single-url-environment-default/full-custom/README.md @@ -114,7 +114,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/single-url-environment-default/full-custom/src/core/http_client.rs b/seed/rust-sdk/single-url-environment-default/full-custom/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/single-url-environment-default/full-custom/src/core/http_client.rs +++ b/seed/rust-sdk/single-url-environment-default/full-custom/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/single-url-environment-no-default/README.md b/seed/rust-sdk/single-url-environment-no-default/README.md index dc686171858e..7f737d47920d 100644 --- a/seed/rust-sdk/single-url-environment-no-default/README.md +++ b/seed/rust-sdk/single-url-environment-no-default/README.md @@ -100,7 +100,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/single-url-environment-no-default/src/core/http_client.rs b/seed/rust-sdk/single-url-environment-no-default/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/single-url-environment-no-default/src/core/http_client.rs +++ b/seed/rust-sdk/single-url-environment-no-default/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/streaming-parameter/README.md b/seed/rust-sdk/streaming-parameter/README.md index 9ec3c6a63e85..409523065705 100644 --- a/seed/rust-sdk/streaming-parameter/README.md +++ b/seed/rust-sdk/streaming-parameter/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/streaming-parameter/src/core/http_client.rs b/seed/rust-sdk/streaming-parameter/src/core/http_client.rs index dca519ee2ad8..ba0f18c6dffe 100644 --- a/seed/rust-sdk/streaming-parameter/src/core/http_client.rs +++ b/seed/rust-sdk/streaming-parameter/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/streaming/README.md b/seed/rust-sdk/streaming/README.md index 3babd57ddc18..4020f3eff564 100644 --- a/seed/rust-sdk/streaming/README.md +++ b/seed/rust-sdk/streaming/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/streaming/src/core/http_client.rs b/seed/rust-sdk/streaming/src/core/http_client.rs index dca519ee2ad8..ba0f18c6dffe 100644 --- a/seed/rust-sdk/streaming/src/core/http_client.rs +++ b/seed/rust-sdk/streaming/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/trace/README.md b/seed/rust-sdk/trace/README.md index 89176cae5f43..e84edc4d6a16 100644 --- a/seed/rust-sdk/trace/README.md +++ b/seed/rust-sdk/trace/README.md @@ -120,7 +120,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/trace/src/core/http_client.rs b/seed/rust-sdk/trace/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/trace/src/core/http_client.rs +++ b/seed/rust-sdk/trace/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/undiscriminated-union-with-response-property/README.md b/seed/rust-sdk/undiscriminated-union-with-response-property/README.md index 020b6c31b113..92bafb706e05 100644 --- a/seed/rust-sdk/undiscriminated-union-with-response-property/README.md +++ b/seed/rust-sdk/undiscriminated-union-with-response-property/README.md @@ -85,7 +85,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/undiscriminated-union-with-response-property/src/core/http_client.rs b/seed/rust-sdk/undiscriminated-union-with-response-property/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/undiscriminated-union-with-response-property/src/core/http_client.rs +++ b/seed/rust-sdk/undiscriminated-union-with-response-property/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/undiscriminated-unions/README.md b/seed/rust-sdk/undiscriminated-unions/README.md index 223d443afc04..feaebab3a7e6 100644 --- a/seed/rust-sdk/undiscriminated-unions/README.md +++ b/seed/rust-sdk/undiscriminated-unions/README.md @@ -100,7 +100,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/undiscriminated-unions/src/core/http_client.rs b/seed/rust-sdk/undiscriminated-unions/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/undiscriminated-unions/src/core/http_client.rs +++ b/seed/rust-sdk/undiscriminated-unions/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/union-query-parameters/README.md b/seed/rust-sdk/union-query-parameters/README.md index 3d831c6cf7c7..ae34c1a45fc1 100644 --- a/seed/rust-sdk/union-query-parameters/README.md +++ b/seed/rust-sdk/union-query-parameters/README.md @@ -94,7 +94,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/union-query-parameters/src/core/http_client.rs b/seed/rust-sdk/union-query-parameters/src/core/http_client.rs index 9c8e7f672d30..121bc226bb2e 100644 --- a/seed/rust-sdk/union-query-parameters/src/core/http_client.rs +++ b/seed/rust-sdk/union-query-parameters/src/core/http_client.rs @@ -451,6 +451,14 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { + // Exponential backoff for retryable HTTP status codes + let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); + tokio::time::sleep(delay).await; + } Ok(response) => { let status_code = response.status().as_u16(); let body = response.text().await.ok(); @@ -469,6 +477,10 @@ impl HttpClient { Err(ApiError::Network(last_error.unwrap())) } + fn is_retryable_status(status_code: u16) -> bool { + [408, 429].contains(&status_code) || status_code >= 500 + } + async fn parse_response(&self, response: Response) -> Result where T: DeserializeOwned, @@ -644,3 +656,29 @@ impl HttpClient { Ok(ByteStream::new(response)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_retryable_status() { + // Retryable 4xx + assert!(HttpClient::is_retryable_status(408)); + assert!(HttpClient::is_retryable_status(429)); + + // Retryable 5xx (>= 500) + assert!(HttpClient::is_retryable_status(500)); + assert!(HttpClient::is_retryable_status(501)); + assert!(HttpClient::is_retryable_status(502)); + assert!(HttpClient::is_retryable_status(503)); + assert!(HttpClient::is_retryable_status(504)); + assert!(HttpClient::is_retryable_status(599)); + + // Success and other 4xx codes are NOT retryable + assert!(!HttpClient::is_retryable_status(200)); + assert!(!HttpClient::is_retryable_status(400)); + assert!(!HttpClient::is_retryable_status(401)); + assert!(!HttpClient::is_retryable_status(404)); + } +} diff --git a/seed/rust-sdk/unions-with-local-date/README.md b/seed/rust-sdk/unions-with-local-date/README.md index 82400c553492..db4ac2e0e2d5 100644 --- a/seed/rust-sdk/unions-with-local-date/README.md +++ b/seed/rust-sdk/unions-with-local-date/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/unions-with-local-date/src/core/http_client.rs b/seed/rust-sdk/unions-with-local-date/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/unions-with-local-date/src/core/http_client.rs +++ b/seed/rust-sdk/unions-with-local-date/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/unions/README.md b/seed/rust-sdk/unions/README.md index 82400c553492..db4ac2e0e2d5 100644 --- a/seed/rust-sdk/unions/README.md +++ b/seed/rust-sdk/unions/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/unions/src/core/http_client.rs b/seed/rust-sdk/unions/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/unions/src/core/http_client.rs +++ b/seed/rust-sdk/unions/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/unknown/README.md b/seed/rust-sdk/unknown/README.md index a18582cff606..f9a2a2ee9d00 100644 --- a/seed/rust-sdk/unknown/README.md +++ b/seed/rust-sdk/unknown/README.md @@ -87,7 +87,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/unknown/src/core/http_client.rs b/seed/rust-sdk/unknown/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/unknown/src/core/http_client.rs +++ b/seed/rust-sdk/unknown/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/url-form-encoded/README.md b/seed/rust-sdk/url-form-encoded/README.md index eff21a8d8124..94a4a55420d3 100644 --- a/seed/rust-sdk/url-form-encoded/README.md +++ b/seed/rust-sdk/url-form-encoded/README.md @@ -105,7 +105,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/url-form-encoded/src/core/http_client.rs b/seed/rust-sdk/url-form-encoded/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/url-form-encoded/src/core/http_client.rs +++ b/seed/rust-sdk/url-form-encoded/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/validation/README.md b/seed/rust-sdk/validation/README.md index 6a296286af3c..85f152418647 100644 --- a/seed/rust-sdk/validation/README.md +++ b/seed/rust-sdk/validation/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/validation/src/core/http_client.rs b/seed/rust-sdk/validation/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/validation/src/core/http_client.rs +++ b/seed/rust-sdk/validation/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/variables/README.md b/seed/rust-sdk/variables/README.md index 48f10d9c3628..d6e7fc42db0e 100644 --- a/seed/rust-sdk/variables/README.md +++ b/seed/rust-sdk/variables/README.md @@ -84,7 +84,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/variables/src/core/http_client.rs b/seed/rust-sdk/variables/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/variables/src/core/http_client.rs +++ b/seed/rust-sdk/variables/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/version-no-default/README.md b/seed/rust-sdk/version-no-default/README.md index 17d7d9abc37c..da21c4994e16 100644 --- a/seed/rust-sdk/version-no-default/README.md +++ b/seed/rust-sdk/version-no-default/README.md @@ -87,7 +87,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/version-no-default/src/core/http_client.rs b/seed/rust-sdk/version-no-default/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/version-no-default/src/core/http_client.rs +++ b/seed/rust-sdk/version-no-default/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/version/README.md b/seed/rust-sdk/version/README.md index 17d7d9abc37c..da21c4994e16 100644 --- a/seed/rust-sdk/version/README.md +++ b/seed/rust-sdk/version/README.md @@ -87,7 +87,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/version/src/core/http_client.rs b/seed/rust-sdk/version/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/version/src/core/http_client.rs +++ b/seed/rust-sdk/version/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/webhook-audience/src/core/http_client.rs b/seed/rust-sdk/webhook-audience/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/webhook-audience/src/core/http_client.rs +++ b/seed/rust-sdk/webhook-audience/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/webhooks/src/core/http_client.rs b/seed/rust-sdk/webhooks/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/webhooks/src/core/http_client.rs +++ b/seed/rust-sdk/webhooks/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/websocket-bearer-auth/src/core/http_client.rs b/seed/rust-sdk/websocket-bearer-auth/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/websocket-bearer-auth/src/core/http_client.rs +++ b/seed/rust-sdk/websocket-bearer-auth/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/websocket-inferred-auth/README.md b/seed/rust-sdk/websocket-inferred-auth/README.md index 836bd2c79bfd..23695d8a0d57 100644 --- a/seed/rust-sdk/websocket-inferred-auth/README.md +++ b/seed/rust-sdk/websocket-inferred-auth/README.md @@ -142,7 +142,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/websocket-inferred-auth/src/core/http_client.rs b/seed/rust-sdk/websocket-inferred-auth/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/websocket-inferred-auth/src/core/http_client.rs +++ b/seed/rust-sdk/websocket-inferred-auth/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/websocket-multi-url/src/core/http_client.rs b/seed/rust-sdk/websocket-multi-url/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/websocket-multi-url/src/core/http_client.rs +++ b/seed/rust-sdk/websocket-multi-url/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/websocket/src/core/http_client.rs b/seed/rust-sdk/websocket/src/core/http_client.rs index 5d20493bb524..c2a96a2118c2 100644 --- a/seed/rust-sdk/websocket/src/core/http_client.rs +++ b/seed/rust-sdk/websocket/src/core/http_client.rs @@ -451,7 +451,6 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; diff --git a/seed/rust-sdk/x-fern-default/README.md b/seed/rust-sdk/x-fern-default/README.md index f7470798f516..4e8fb119339a 100644 --- a/seed/rust-sdk/x-fern-default/README.md +++ b/seed/rust-sdk/x-fern-default/README.md @@ -92,7 +92,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` method to configure this behavior. diff --git a/seed/rust-sdk/x-fern-default/src/core/http_client.rs b/seed/rust-sdk/x-fern-default/src/core/http_client.rs index d5b11fc4094f..121bc226bb2e 100644 --- a/seed/rust-sdk/x-fern-default/src/core/http_client.rs +++ b/seed/rust-sdk/x-fern-default/src/core/http_client.rs @@ -451,8 +451,10 @@ impl HttpClient { match self.client.execute(cloned_request).await { Ok(response) if response.status().is_success() => return Ok(response), - Ok(response) if attempt < max_retries && Self::is_retryable_status(response.status().as_u16()) => { - drop(response); + Ok(response) + if attempt < max_retries + && Self::is_retryable_status(response.status().as_u16()) => + { // Exponential backoff for retryable HTTP status codes let delay = std::time::Duration::from_millis(100 * 2_u64.pow(attempt)); tokio::time::sleep(delay).await; From 0a55feb14f717840dc46811fdb3a1f2e283b0881 Mon Sep 17 00:00:00 2001 From: Naman Anand Date: Wed, 29 Apr 2026 20:23:30 +0530 Subject: [PATCH 04/43] feat(ruby): add config-driven retryStatusCodes with legacy/recommended modes (#15418) * fix(ruby): only retry on 408, 429, and 5xx except 500 Replaced fixed RETRYABLE_STATUSES list [408, 429, 500, 502, 503, 504, 521, 522, 524] with [408, 429] plus range check (>= 501 && < 600). 500 Internal Server Error is no longer retried. * fix: add 5XX hyperlink to features.yml to match TS PR pattern * fix(ruby): update changelog wording to match PR pattern * fix(ruby): rename RETRYABLE_STATUSES to RETRYABLE_4XX_STATUSES and add should_retry? tests Co-Authored-By: Claude Sonnet 4.6 * feat(ruby): add config-driven retryStatusCodes with legacy/recommended modes - Add retryStatusCodes field to BaseRubyCustomConfigSchema (legacy | recommended) - Legacy (default): [408, 429, 500, 502, 503, 504, 521, 522, 524] - Recommended: [408, 429, 502, 503, 504] (excludes 500 Internal Server Error) - Apply string replacement in RubyProject.ts when config is recommended - Add TestHttpRawClient as-is file with should_retry? tests - Create 2.0.0 migration to auto-pin legacy for existing users - Register Ruby SDK migrations in main index - Update features.yml documenting both modes - Revert 125 seed raw_client.rb files to legacy behavior - Update 125 seed test_raw_client.rb files to test legacy behavior * fix: biome formatting for RubyProject.ts return statement * fix: mark @boundaryml/baml as external in ruby-sdk build to fix esbuild native module errors * refactor: use template variable for retryStatusCodes instead of find/replace * fix: drop @boundaryml/baml external from build.mjs (now in shared build-utils) * refactor(ruby): use {{RETRY_STATUS_CODES_ARRAY}} placeholder pattern like TS/Rust Replace EJS retryStatusCodes ternary with {{RETRY_STATUS_CODES_ARRAY}} placeholder resolved by RubyProject.ts after EJS rendering, matching the identical pattern used in TS and Rust generators. --------- Co-authored-by: Claude Sonnet 4.6 --- .../BaseRubyCustomConfigSchema.ts | 3 +- generators/ruby-v2/base/src/AsIs.ts | 5 +- .../asIs/internal/http/raw_client.Template.rb | 2 +- .../internal/http/test_raw_client.Template.rb | 57 +++++++++++++++++++ .../ruby-v2/base/src/project/RubyProject.ts | 38 +++++++------ .../unreleased/fix-retry-status-codes.yml | 6 ++ generators/ruby-v2/sdk/features.yml | 7 ++- .../ruby-v2/sdk/src/SdkGeneratorContext.ts | 5 +- .../src/__test__/index.test.ts | 29 +++++++++- .../src/generators/ruby/migrations/2.0.0.ts | 30 ++++++++++ .../src/generators/ruby/migrations/index.ts | 20 +++++++ packages/generator-migrations/src/index.ts | 4 ++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ 137 files changed, 7309 insertions(+), 22 deletions(-) create mode 100644 generators/ruby-v2/base/src/asIs/test/unit/internal/http/test_raw_client.Template.rb create mode 100644 generators/ruby-v2/sdk/changes/unreleased/fix-retry-status-codes.yml create mode 100644 packages/generator-migrations/src/generators/ruby/migrations/2.0.0.ts create mode 100644 packages/generator-migrations/src/generators/ruby/migrations/index.ts create mode 100644 seed/ruby-sdk-v2/accept-header/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/alias-extends/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/alias/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/allof-inline/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/allof/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/any-auth/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/api-wide-base-path/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/audiences/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/basic-auth-environment-variables/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/basic-auth-pw-omitted/wire-tests/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/basic-auth/wire-tests/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/bearer-token-environment-variable/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/bytes-download/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/bytes-upload/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/circular-references-advanced/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/circular-references-extends/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/circular-references/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/client-side-params/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/content-type/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/cross-package-type-names/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/dollar-string-examples/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/empty-clients/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/endpoint-security-auth/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/enum/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/error-property/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/errors/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/examples/no-custom-config/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/examples/omit-fern-headers/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/examples/readme-config/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/examples/require-paths/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/examples/wire-tests/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/exhaustive/wire-tests/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/extends/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/extra-properties/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/file-download/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/file-upload-openapi/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/file-upload/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/folders/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/header-auth-environment-variable/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/header-auth/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/http-head/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/idempotency-headers/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/imdb/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/inferred-auth-explicit/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/inferred-auth-implicit-api-key/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/inferred-auth-implicit-no-expiry/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/inferred-auth-implicit-reference/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/inferred-auth-implicit/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/license/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/literal/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/literals-unions/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/mixed-case/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/mixed-file-directory/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/multi-line-docs/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/multi-url-environment-no-default/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/multi-url-environment-reference/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/multi-url-environment/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/multiple-request-bodies/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/no-content-response/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/no-environment/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/no-retries/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/null-type/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/nullable-allof-extends/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/nullable-optional/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/nullable-request-body/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/nullable/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/oauth-client-credentials-custom/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/oauth-client-credentials-default/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/oauth-client-credentials-environment-variables/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/oauth-client-credentials-mandatory-auth/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/oauth-client-credentials-nested-root/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/oauth-client-credentials-openapi/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/oauth-client-credentials-reference/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/oauth-client-credentials-with-variables/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/oauth-client-credentials/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/object/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/objects-with-imports/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/optional/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/package-yml/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/pagination-custom/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/pagination-uri-path/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/pagination/no-custom-config/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/pagination/page-index-semantics/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/path-parameters/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/plain-text/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/property-access/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/public-object/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/query-param-name-conflict/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/query-parameters-openapi-as-objects/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/query-parameters-openapi/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/query-parameters/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/request-parameters/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/required-nullable/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/reserved-keywords/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/response-property/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/ruby-reserved-word-properties/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/schemaless-request-body-examples/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/server-sent-event-examples/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/server-sent-events-openapi/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/server-sent-events/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/server-url-templating/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/simple-api/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/simple-fhir/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/single-url-environment-default/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/single-url-environment-no-default/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/streaming-parameter/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/streaming/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/trace/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/undiscriminated-union-with-response-property/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/undiscriminated-unions/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/unions-with-local-date/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/unions/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/unknown/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/url-form-encoded/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/validation/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/variables/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/version-no-default/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/version/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/webhook-audience/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/webhooks/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/websocket-bearer-auth/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/websocket-inferred-auth/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/websocket-multi-url/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/websocket/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/x-fern-default/test/unit/internal/http/test_raw_client.rb diff --git a/generators/ruby-v2/ast/src/custom-config/BaseRubyCustomConfigSchema.ts b/generators/ruby-v2/ast/src/custom-config/BaseRubyCustomConfigSchema.ts index 6bae0a2a3671..b30fcf63547b 100644 --- a/generators/ruby-v2/ast/src/custom-config/BaseRubyCustomConfigSchema.ts +++ b/generators/ruby-v2/ast/src/custom-config/BaseRubyCustomConfigSchema.ts @@ -43,7 +43,8 @@ export const BaseRubyCustomConfigSchema = z.object({ // - "warning": reports violations as warnings (default for customer SDKs) // - "error": reports violations as errors (used in seed to enforce rubocop) rubocopSeverity: z.enum(["info", "warning", "error"]).optional(), - maxRetries: z.number().int().min(0).optional() + maxRetries: z.number().int().min(0).optional(), + retryStatusCodes: z.optional(z.enum(["legacy", "recommended"])) }); export type BaseRubyCustomConfigSchema = z.infer; diff --git a/generators/ruby-v2/base/src/AsIs.ts b/generators/ruby-v2/base/src/AsIs.ts index a2b848b8252f..62485147a332 100644 --- a/generators/ruby-v2/base/src/AsIs.ts +++ b/generators/ruby-v2/base/src/AsIs.ts @@ -64,7 +64,10 @@ export const AsIsFiles = { TestHashType: "test/unit/internal/types/test_hash.Template.rb", TestModelType: "test/unit/internal/types/test_model.Template.rb", TestUnionType: "test/unit/internal/types/test_union.Template.rb", - TestTypeUtils: "test/unit/internal/types/test_utils.Template.rb" + TestTypeUtils: "test/unit/internal/types/test_utils.Template.rb", + + // HTTP tests + TestHttpRawClient: "test/unit/internal/http/test_raw_client.Template.rb" } as const; export function topologicalCompareAsIsFiles(fileA: string, fileB: string): number { diff --git a/generators/ruby-v2/base/src/asIs/internal/http/raw_client.Template.rb b/generators/ruby-v2/base/src/asIs/internal/http/raw_client.Template.rb index 532caef17d8d..f7a978727a80 100644 --- a/generators/ruby-v2/base/src/asIs/internal/http/raw_client.Template.rb +++ b/generators/ruby-v2/base/src/asIs/internal/http/raw_client.Template.rb @@ -6,7 +6,7 @@ module Http # @api private class RawClient # Default HTTP status codes that trigger a retry - RETRYABLE_STATUSES = [408, 429, 500, 502, 503, 504, 521, 522, 524].freeze + RETRYABLE_STATUSES = {{RETRY_STATUS_CODES_ARRAY}} # Initial delay between retries in seconds INITIAL_RETRY_DELAY = 0.5 # Maximum delay between retries in seconds diff --git a/generators/ruby-v2/base/src/asIs/test/unit/internal/http/test_raw_client.Template.rb b/generators/ruby-v2/base/src/asIs/test/unit/internal/http/test_raw_client.Template.rb new file mode 100644 index 000000000000..387e01ddfe54 --- /dev/null +++ b/generators/ruby-v2/base/src/asIs/test/unit/internal/http/test_raw_client.Template.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe <%= gem_namespace %>::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + <%= gem_namespace %>::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/generators/ruby-v2/base/src/project/RubyProject.ts b/generators/ruby-v2/base/src/project/RubyProject.ts index afb822eb9950..525ac74b936e 100644 --- a/generators/ruby-v2/base/src/project/RubyProject.ts +++ b/generators/ruby-v2/base/src/project/RubyProject.ts @@ -208,7 +208,8 @@ export class RubyProject extends AbstractProject { - const contents = (await readFile(getAsIsFilepath(filename))).toString(); - return new File( - this.getAsIsOutputFilename(filename), - this.getAsIsOutputDirectory(filename), - replaceTemplate({ - contents, - variables: getTemplateVariables({ - gemNamespace, - rootFolderName, - customPagerClassName, - omitFernHeaders, - maxRetries - }) + let rendered = replaceTemplate({ + contents: (await readFile(getAsIsFilepath(filename))).toString(), + variables: getTemplateVariables({ + gemNamespace, + rootFolderName, + customPagerClassName, + omitFernHeaders, + maxRetries }) - ); + }); + + const retryStatusCodesArray = + retryStatusCodes === "recommended" + ? "[408, 429, 502, 503, 504].freeze" + : "[408, 429, 500, 502, 503, 504, 521, 522, 524].freeze"; + rendered = rendered.replace(/\{\{RETRY_STATUS_CODES_ARRAY\}\}/g, retryStatusCodesArray); + + return new File(this.getAsIsOutputFilename(filename), this.getAsIsOutputDirectory(filename), rendered); } public getAsIsOutputDirectory(templateFileName: string): RelativeFilePath { diff --git a/generators/ruby-v2/sdk/changes/unreleased/fix-retry-status-codes.yml b/generators/ruby-v2/sdk/changes/unreleased/fix-retry-status-codes.yml new file mode 100644 index 000000000000..fbfc8bcdbafd --- /dev/null +++ b/generators/ruby-v2/sdk/changes/unreleased/fix-retry-status-codes.yml @@ -0,0 +1,6 @@ +- summary: | + Add `retryStatusCodes` configuration option (`"legacy"` | `"recommended"`). + Legacy (default) preserves existing behavior (408, 429, 500, 502, 503, 504, 521, 522, 524). + Recommended retries only transient codes (408, 429, 502, 503, 504), excluding + 500 Internal Server Error to avoid retrying non-idempotent failures. + type: feat diff --git a/generators/ruby-v2/sdk/features.yml b/generators/ruby-v2/sdk/features.yml index 1a75f53983b8..c6bcc81939aa 100644 --- a/generators/ruby-v2/sdk/features.yml +++ b/generators/ruby-v2/sdk/features.yml @@ -23,7 +23,12 @@ features: - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) - - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) + - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + + The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + + - `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` + - `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/generators/ruby-v2/sdk/src/SdkGeneratorContext.ts b/generators/ruby-v2/sdk/src/SdkGeneratorContext.ts index 343aca8c197a..8bcde5dd8b8f 100644 --- a/generators/ruby-v2/sdk/src/SdkGeneratorContext.ts +++ b/generators/ruby-v2/sdk/src/SdkGeneratorContext.ts @@ -371,7 +371,10 @@ export class SdkGeneratorContext extends AbstractRubyGeneratorContext { }); }); + describe("Ruby SDK migrations", () => { + it("includes Ruby SDK migration entries", () => { + expect(migrations["fernapi/fern-ruby-sdk"]).toBeDefined(); + expect(migrations["fernapi/fern-ruby-sdk"]?.migrations).toBeDefined(); + expect(Array.isArray(migrations["fernapi/fern-ruby-sdk"]?.migrations)).toBe(true); + }); + + it("Ruby SDK migrations have correct structure", () => { + const module = migrations["fernapi/fern-ruby-sdk"]; + + expect(module).toBeDefined(); + expect(module?.migrations.length).toBeGreaterThan(0); + + for (const migration of module?.migrations ?? []) { + expect(migration).toHaveProperty("version"); + expect(migration).toHaveProperty("migrateGeneratorConfig"); + expect(migration).toHaveProperty("migrateGeneratorsYml"); + } + }); + + it("Ruby SDK migrations are in semver order", () => { + const module = migrations["fernapi/fern-ruby-sdk"]; + const versions = module?.migrations.map((m) => m.version) ?? []; + + expect(versions).toEqual(["2.0.0"]); + }); + }); + describe("Rust SDK migrations", () => { it("includes Rust SDK migration entries", () => { expect(migrations["fernapi/fern-rust-sdk"]).toBeDefined(); @@ -193,7 +221,6 @@ describe("@fern-api/generator-migrations", () => { describe("generator name lookup", () => { it("returns undefined for generators without migrations", () => { expect(migrations["fernapi/fern-go-sdk"]).toBeUndefined(); - expect(migrations["fernapi/fern-ruby-sdk"]).toBeUndefined(); }); it("requires full generator name with fernapi prefix", () => { diff --git a/packages/generator-migrations/src/generators/ruby/migrations/2.0.0.ts b/packages/generator-migrations/src/generators/ruby/migrations/2.0.0.ts new file mode 100644 index 000000000000..9fb393c71762 --- /dev/null +++ b/packages/generator-migrations/src/generators/ruby/migrations/2.0.0.ts @@ -0,0 +1,30 @@ +import type { Migration } from "@fern-api/migrations-base"; +import { migrateConfig } from "@fern-api/migrations-base"; + +// Migration for version 2.0.0 +// +// Context: +// Version 2.0.0 changes the default retry behavior to only retry on transient +// HTTP status codes (408, 429, 502, 503, 504), excluding 500 Internal Server Error +// and Cloudflare-specific codes (521, 522, 524) that were previously retried. +// +// This migration explicitly pins the old default ("legacy") for users upgrading +// from pre-2.0.0 versions, so their retry behavior remains unchanged. +// +// Changed Defaults: +// - retryStatusCodes: "legacy" → "recommended" +// legacy: [408, 429, 500, 502, 503, 504, 521, 522, 524] +// recommended: [408, 429, 502, 503, 504] +// +// Migration Strategy: +// Uses nullish coalescing assignment to only set the value if not already configured. +export const migration_2_0_0: Migration = { + version: "2.0.0", + + migrateGeneratorConfig: ({ config }) => + migrateConfig(config, (draft) => { + draft.retryStatusCodes ??= "legacy"; + }), + + migrateGeneratorsYml: ({ document }) => document +}; diff --git a/packages/generator-migrations/src/generators/ruby/migrations/index.ts b/packages/generator-migrations/src/generators/ruby/migrations/index.ts new file mode 100644 index 000000000000..024dbdd986aa --- /dev/null +++ b/packages/generator-migrations/src/generators/ruby/migrations/index.ts @@ -0,0 +1,20 @@ +import type { MigrationModule } from "@fern-api/migrations-base"; + +import { migration_2_0_0 } from "./2.0.0.js"; + +/** + * Migration module for Ruby SDK generator. + * + * This module contains migrations for configuration changes for + * the Ruby SDK generator: + * - fernapi/fern-ruby-sdk + * + * Each migration is defined in a separate file under this directory. + * Migrations are automatically applied by the Fern CLI when running: + * `fern generator upgrade --generator ruby-sdk` + */ +const migrationModule: MigrationModule = { + migrations: [migration_2_0_0] +}; + +export default migrationModule; diff --git a/packages/generator-migrations/src/index.ts b/packages/generator-migrations/src/index.ts index 56ecf65b159e..74bbda6cfc9d 100644 --- a/packages/generator-migrations/src/index.ts +++ b/packages/generator-migrations/src/index.ts @@ -11,6 +11,7 @@ import csharpSdkMigrations from "./generators/csharp/migrations/index.js"; import javaSdkMigrations from "./generators/java/migrations/index.js"; import javaModelMigrations from "./generators/java-model/migrations/index.js"; import pythonSdkMigrations from "./generators/python/migrations/index.js"; +import rubySdkMigrations from "./generators/ruby/migrations/index.js"; import rustSdkMigrations from "./generators/rust/migrations/index.js"; import typescriptSdkMigrations from "./generators/typescript/migrations/index.js"; @@ -38,6 +39,9 @@ export const migrations: Record = { "fernapi/fern-fastapi-server": pythonSdkMigrations, "fernapi/fern-pydantic-model": pythonSdkMigrations, + // Ruby SDK + "fernapi/fern-ruby-sdk": rubySdkMigrations, + // Rust SDK "fernapi/fern-rust-sdk": rustSdkMigrations, diff --git a/seed/ruby-sdk-v2/accept-header/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/accept-header/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/accept-header/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/alias-extends/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/alias-extends/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/alias-extends/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/alias/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/alias/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/alias/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/allof-inline/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/allof-inline/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/allof-inline/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/allof/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/allof/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/allof/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/any-auth/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/any-auth/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/any-auth/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/api-wide-base-path/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/api-wide-base-path/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/api-wide-base-path/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/audiences/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/audiences/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/audiences/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/basic-auth-environment-variables/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/basic-auth-environment-variables/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/basic-auth-environment-variables/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/basic-auth-pw-omitted/wire-tests/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/basic-auth-pw-omitted/wire-tests/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/basic-auth-pw-omitted/wire-tests/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/basic-auth/wire-tests/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/basic-auth/wire-tests/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/basic-auth/wire-tests/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/bearer-token-environment-variable/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/bearer-token-environment-variable/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/bearer-token-environment-variable/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/bytes-download/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/bytes-download/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/bytes-download/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/bytes-upload/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/bytes-upload/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/bytes-upload/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/circular-references-advanced/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/circular-references-advanced/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/circular-references-advanced/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/circular-references-extends/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/circular-references-extends/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/circular-references-extends/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/circular-references/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/circular-references/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/circular-references/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/client-side-params/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/client-side-params/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/client-side-params/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/content-type/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/content-type/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/content-type/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/cross-package-type-names/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/cross-package-type-names/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/cross-package-type-names/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/dollar-string-examples/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/dollar-string-examples/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/dollar-string-examples/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/empty-clients/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/empty-clients/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/empty-clients/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/endpoint-security-auth/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/endpoint-security-auth/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/endpoint-security-auth/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/enum/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/enum/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/enum/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/error-property/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/error-property/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/error-property/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/errors/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/errors/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/errors/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/examples/no-custom-config/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/examples/no-custom-config/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/examples/no-custom-config/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/examples/omit-fern-headers/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/examples/omit-fern-headers/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/examples/omit-fern-headers/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/examples/readme-config/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/examples/readme-config/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/examples/readme-config/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/examples/require-paths/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/examples/require-paths/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/examples/require-paths/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/examples/wire-tests/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/examples/wire-tests/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/examples/wire-tests/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/exhaustive/wire-tests/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/exhaustive/wire-tests/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/exhaustive/wire-tests/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/extends/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/extends/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/extends/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/extra-properties/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/extra-properties/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/extra-properties/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/file-download/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/file-download/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/file-download/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/file-upload-openapi/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/file-upload-openapi/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/file-upload-openapi/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/file-upload/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/file-upload/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/file-upload/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/folders/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/folders/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/folders/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/header-auth-environment-variable/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/header-auth-environment-variable/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/header-auth-environment-variable/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/header-auth/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/header-auth/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/header-auth/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/http-head/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/http-head/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/http-head/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/idempotency-headers/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/idempotency-headers/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/idempotency-headers/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/imdb/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/imdb/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/imdb/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/inferred-auth-explicit/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/inferred-auth-explicit/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/inferred-auth-explicit/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/inferred-auth-implicit-api-key/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/inferred-auth-implicit-api-key/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/inferred-auth-implicit-api-key/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/inferred-auth-implicit-no-expiry/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/inferred-auth-implicit-no-expiry/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/inferred-auth-implicit-no-expiry/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/inferred-auth-implicit-reference/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/inferred-auth-implicit-reference/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/inferred-auth-implicit-reference/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/inferred-auth-implicit/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/inferred-auth-implicit/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/inferred-auth-implicit/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/license/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/license/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/license/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/literal/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/literal/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/literal/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/literals-unions/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/literals-unions/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/literals-unions/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/mixed-case/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/mixed-case/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/mixed-case/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/mixed-file-directory/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/mixed-file-directory/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/mixed-file-directory/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/multi-line-docs/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/multi-line-docs/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/multi-line-docs/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/multi-url-environment-no-default/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/multi-url-environment-no-default/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/multi-url-environment-no-default/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/multi-url-environment-reference/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/multi-url-environment-reference/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/multi-url-environment-reference/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/multi-url-environment/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/multi-url-environment/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/multi-url-environment/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/multiple-request-bodies/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/multiple-request-bodies/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/multiple-request-bodies/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/no-content-response/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/no-content-response/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/no-content-response/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/no-environment/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/no-environment/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/no-environment/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/no-retries/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/no-retries/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/no-retries/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/null-type/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/null-type/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/null-type/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/nullable-allof-extends/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/nullable-allof-extends/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/nullable-allof-extends/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/nullable-optional/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/nullable-optional/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/nullable-optional/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/nullable-request-body/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/nullable-request-body/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/nullable-request-body/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/nullable/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/nullable/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/nullable/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-custom/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/oauth-client-credentials-custom/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/oauth-client-credentials-custom/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-default/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/oauth-client-credentials-default/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/oauth-client-credentials-default/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-environment-variables/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/oauth-client-credentials-environment-variables/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/oauth-client-credentials-environment-variables/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-mandatory-auth/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/oauth-client-credentials-mandatory-auth/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/oauth-client-credentials-mandatory-auth/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-nested-root/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/oauth-client-credentials-nested-root/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/oauth-client-credentials-nested-root/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-openapi/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/oauth-client-credentials-openapi/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/oauth-client-credentials-openapi/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-reference/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/oauth-client-credentials-reference/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/oauth-client-credentials-reference/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-with-variables/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/oauth-client-credentials-with-variables/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/oauth-client-credentials-with-variables/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/oauth-client-credentials/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/oauth-client-credentials/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/oauth-client-credentials/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/object/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/object/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/object/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/objects-with-imports/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/objects-with-imports/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/objects-with-imports/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/optional/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/optional/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/optional/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/package-yml/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/package-yml/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/package-yml/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/pagination-custom/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/pagination-custom/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/pagination-custom/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/pagination-uri-path/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/pagination-uri-path/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/pagination-uri-path/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/pagination/no-custom-config/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/pagination/no-custom-config/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/pagination/no-custom-config/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/pagination/page-index-semantics/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/pagination/page-index-semantics/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/pagination/page-index-semantics/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/path-parameters/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/path-parameters/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/path-parameters/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/plain-text/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/plain-text/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/plain-text/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/property-access/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/property-access/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/property-access/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/public-object/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/public-object/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/public-object/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/query-param-name-conflict/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/query-param-name-conflict/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/query-param-name-conflict/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/query-parameters-openapi-as-objects/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/query-parameters-openapi-as-objects/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/query-parameters-openapi-as-objects/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/query-parameters-openapi/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/query-parameters-openapi/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/query-parameters-openapi/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/query-parameters/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/query-parameters/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/query-parameters/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/request-parameters/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/request-parameters/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/request-parameters/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/required-nullable/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/required-nullable/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/required-nullable/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/reserved-keywords/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/reserved-keywords/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/reserved-keywords/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/response-property/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/response-property/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/response-property/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/ruby-reserved-word-properties/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/ruby-reserved-word-properties/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/ruby-reserved-word-properties/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/schemaless-request-body-examples/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/schemaless-request-body-examples/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/schemaless-request-body-examples/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/server-sent-event-examples/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/server-sent-event-examples/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/server-sent-events-openapi/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/server-sent-events-openapi/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/server-sent-events-openapi/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/server-sent-events/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/server-sent-events/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/server-sent-events/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/server-url-templating/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/server-url-templating/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/server-url-templating/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/simple-api/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/simple-api/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/simple-api/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/simple-fhir/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/simple-fhir/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/simple-fhir/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/single-url-environment-default/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/single-url-environment-default/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/single-url-environment-default/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/single-url-environment-no-default/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/single-url-environment-no-default/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/single-url-environment-no-default/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/streaming-parameter/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/streaming-parameter/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/streaming-parameter/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/streaming/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/streaming/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/streaming/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/trace/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/trace/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/trace/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/undiscriminated-union-with-response-property/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/undiscriminated-union-with-response-property/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/undiscriminated-union-with-response-property/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/undiscriminated-unions/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/undiscriminated-unions/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/undiscriminated-unions/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/unions-with-local-date/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/unions-with-local-date/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/unions-with-local-date/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/unions/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/unions/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/unions/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/unknown/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/unknown/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/unknown/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/url-form-encoded/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/url-form-encoded/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/url-form-encoded/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/validation/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/validation/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/validation/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/variables/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/variables/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/variables/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/version-no-default/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/version-no-default/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/version-no-default/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/version/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/version/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/version/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/webhook-audience/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/webhook-audience/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/webhook-audience/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/webhooks/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/webhooks/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/webhooks/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/websocket-bearer-auth/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/websocket-bearer-auth/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/websocket-bearer-auth/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/websocket-inferred-auth/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/websocket-inferred-auth/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/websocket-inferred-auth/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/websocket-multi-url/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/websocket-multi-url/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/websocket-multi-url/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/websocket/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/websocket/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/websocket/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/x-fern-default/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/x-fern-default/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/x-fern-default/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end From db27e3c115ea62b75dad6aed8df7771e9c5ad12c Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 10:55:11 -0400 Subject: [PATCH 05/43] chore(rust): update rust-sdk seed (#15561) Co-authored-by: dsinghvi <10870189+dsinghvi@users.noreply.github.com> From 71061e2c012e9526f9e655e365dd5674d9b5885b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 14:57:30 +0000 Subject: [PATCH 06/43] chore(ruby-v2): release 1.11.0 --- .../{unreleased => 1.11.0}/fix-retry-status-codes.yml | 0 generators/ruby-v2/sdk/versions.yml | 10 ++++++++++ 2 files changed, 10 insertions(+) rename generators/ruby-v2/sdk/changes/{unreleased => 1.11.0}/fix-retry-status-codes.yml (100%) diff --git a/generators/ruby-v2/sdk/changes/unreleased/fix-retry-status-codes.yml b/generators/ruby-v2/sdk/changes/1.11.0/fix-retry-status-codes.yml similarity index 100% rename from generators/ruby-v2/sdk/changes/unreleased/fix-retry-status-codes.yml rename to generators/ruby-v2/sdk/changes/1.11.0/fix-retry-status-codes.yml diff --git a/generators/ruby-v2/sdk/versions.yml b/generators/ruby-v2/sdk/versions.yml index 5e9eac1247e7..05c63d031b01 100644 --- a/generators/ruby-v2/sdk/versions.yml +++ b/generators/ruby-v2/sdk/versions.yml @@ -1,4 +1,14 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 1.11.0 + changelogEntry: + - summary: | + Add `retryStatusCodes` configuration option (`"legacy"` | `"recommended"`). + Legacy (default) preserves existing behavior (408, 429, 500, 502, 503, 504, 521, 522, 524). + Recommended retries only transient codes (408, 429, 502, 503, 504), excluding + 500 Internal Server Error to avoid retrying non-idempotent failures. + type: feat + createdAt: "2026-04-29" + irVersion: 66 - version: 1.10.0 changelogEntry: - summary: | From 7264833766814baf088614d24faf5dffe07a808d Mon Sep 17 00:00:00 2001 From: Naman Anand Date: Wed, 29 Apr 2026 20:31:41 +0530 Subject: [PATCH 07/43] feat(go): add config-driven retryStatusCodes with legacy/recommended modes (#15417) * fix(go): only retry on 408, 429, and 5xx except 500 Updated shouldRetry to check > StatusInternalServerError instead of >= StatusInternalServerError, so that 500 is no longer retried. Added test case verifying 500 is not retried. * fix: add 5XX hyperlink to features.yml to match TS PR pattern * fix(go): update changelog wording and add 501/599 boundary tests * feat(go): add retryStatusCodes config with legacy and recommended modes Add config-driven retry behavior with 'retryStatusCodes' field: - 'legacy' (default): retries on 408, 429, and all >= 500 - 'recommended': retries only on transient codes 408, 429, 502, 503, 504 Includes: - BaseGoCustomConfigSchema field - String replacement in GoProject.ts for retrier.go_ - 1.0.0 migration (first Go migration) to pin legacy for upgrading users - Updated features.yml, changelog, tests, and seed fixtures * fix: update migration index test - Go SDK now has migrations * fix: mark @boundaryml/baml as external in go-v2 build to prevent esbuild native module errors * ci: re-trigger quality checks * refactor: use template variable for retryStatusCodes instead of find/replace * fix: drop @boundaryml/baml external from build.mjs (now in shared build-utils) * fix: remove unused AsIsFiles import (biome) * refactor(go): use {{RETRY_STATUS_CHECK}} placeholder pattern like TS/Rust Replace {{ .RetryStatusCheck }} Handlebars-style template variable with {{RETRY_STATUS_CHECK}} placeholder resolved by GoProject.ts, matching the identical pattern used in TS and Rust generators. --- .../custom-config/BaseGoCustomConfigSchema.ts | 3 ++- .../go-v2/base/src/asIs/internal/retrier.go_ | 4 +--- .../go-v2/base/src/project/GoProject.ts | 6 +++++ generators/go-v2/sdk/features.yml | 12 ++++++++-- .../sdk/auth/fixtures/internal/retrier.go | 2 +- .../auth/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/basic/fixtures/internal/retrier.go | 2 +- .../basic/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/bearer/fixtures/internal/retrier.go | 2 +- .../bearer/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/bytes/fixtures/internal/retrier.go | 2 +- .../bytes/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/cycle/fixtures/internal/retrier.go | 2 +- .../cycle/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/default/fixtures/internal/retrier.go | 2 +- .../default/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/docs/fixtures/internal/retrier.go | 2 +- .../docs/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/download/fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/empty/fixtures/internal/retrier.go | 2 +- .../empty/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../environments/fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/error/fixtures/internal/retrier.go | 2 +- .../error/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/headers/fixtures/internal/retrier.go | 2 +- .../headers/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/mergent/fixtures/internal/retrier.go | 2 +- .../mergent/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/packages/fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../path-params/fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../pointer-core/fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../query-params/fixtures/internal/retrier.go | 2 +- .../fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/root/fixtures/internal/retrier.go | 2 +- .../root/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../sdk/upload/fixtures/internal/retrier.go | 2 +- .../upload/fixtures/internal/retrier_test.go | 19 +++++++++++++-- .../unreleased/fix-retry-status-codes.yml | 6 +++++ .../src/__test__/index.test.ts | 17 +++++++++++++- .../src/generators/go/migrations/1.0.0.ts | 23 +++++++++++++++++++ .../src/generators/go/migrations/index.ts | 20 ++++++++++++++++ packages/generator-migrations/src/index.ts | 5 ++++ 79 files changed, 719 insertions(+), 112 deletions(-) create mode 100644 generators/go/sdk/changes/unreleased/fix-retry-status-codes.yml create mode 100644 packages/generator-migrations/src/generators/go/migrations/1.0.0.ts create mode 100644 packages/generator-migrations/src/generators/go/migrations/index.ts diff --git a/generators/go-v2/ast/src/custom-config/BaseGoCustomConfigSchema.ts b/generators/go-v2/ast/src/custom-config/BaseGoCustomConfigSchema.ts index d3351e086075..90961ef371ab 100644 --- a/generators/go-v2/ast/src/custom-config/BaseGoCustomConfigSchema.ts +++ b/generators/go-v2/ast/src/custom-config/BaseGoCustomConfigSchema.ts @@ -29,7 +29,8 @@ export const baseGoCustomConfigSchema = z.strictObject({ customPagerName: z.string().optional(), offsetSemantics: z.enum(["item-index", "page-index"]).optional(), omitFernHeaders: z.boolean().optional(), - maxRetries: z.number().int().min(0).optional() + maxRetries: z.number().int().min(0).optional(), + retryStatusCodes: z.optional(z.enum(["legacy", "recommended"])) }); export type BaseGoCustomConfigSchema = z.infer; diff --git a/generators/go-v2/base/src/asIs/internal/retrier.go_ b/generators/go-v2/base/src/asIs/internal/retrier.go_ index bd55b47f411c..9b4e4836efa1 100644 --- a/generators/go-v2/base/src/asIs/internal/retrier.go_ +++ b/generators/go-v2/base/src/asIs/internal/retrier.go_ @@ -138,9 +138,7 @@ func (r *Retrier) run( // shouldRetry returns true if the request should be retried based on the given // response status code. func (r *Retrier) shouldRetry(response *http.Response) bool { - return response.StatusCode == http.StatusTooManyRequests || - response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + return {{RETRY_STATUS_CHECK}} } // retryDelay calculates the delay time based on response headers, diff --git a/generators/go-v2/base/src/project/GoProject.ts b/generators/go-v2/base/src/project/GoProject.ts index d878ae865954..fd5a5a7e541e 100644 --- a/generators/go-v2/base/src/project/GoProject.ts +++ b/generators/go-v2/base/src/project/GoProject.ts @@ -205,6 +205,12 @@ export class GoProject extends AbstractProject= http.StatusInternalServerError"; + contents = contents.replace(/\{\{RETRY_STATUS_CHECK\}\}/g, retryStatusCheck); + return new File(filename.replace(".go_", ".go"), RelativeFilePath.of(""), contents); } diff --git a/generators/go-v2/sdk/features.yml b/generators/go-v2/sdk/features.yml index b81d1f86fa7e..7399267e2300 100644 --- a/generators/go-v2/sdk/features.yml +++ b/generators/go-v2/sdk/features.yml @@ -61,11 +61,19 @@ features: as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). - A request is deemed retryable when any of the following HTTP status codes is returned: + Which status codes are retried depends on the `retryStatusCodes` generator configuration: + **`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) - - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) + - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + + **`recommended`**: retries on + - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) + - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) + - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) + - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) + - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/generators/go/internal/testdata/sdk/auth/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/auth/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/auth/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/auth/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/auth/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/auth/fixtures/internal/retrier_test.go index 690af6ca0dd6..d942e9344b9b 100644 --- a/generators/go/internal/testdata/sdk/auth/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/auth/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/basic/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/basic/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/basic/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/basic/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/basic/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/basic/fixtures/internal/retrier_test.go index 17807250aa48..c74ac4046c34 100644 --- a/generators/go/internal/testdata/sdk/basic/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/basic/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/bearer-token-name/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/bearer-token-name/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/bearer-token-name/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/bearer-token-name/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/bearer-token-name/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/bearer-token-name/fixtures/internal/retrier_test.go index cbb151c41207..8861e17f9ce7 100644 --- a/generators/go/internal/testdata/sdk/bearer-token-name/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/bearer-token-name/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/bearer/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/bearer/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/bearer/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/bearer/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/bearer/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/bearer/fixtures/internal/retrier_test.go index 60edae7d529b..356878d0cb9e 100644 --- a/generators/go/internal/testdata/sdk/bearer/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/bearer/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/bytes/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/bytes/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/bytes/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/bytes/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/bytes/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/bytes/fixtures/internal/retrier_test.go index 238decd736c1..1bc6cc33fa88 100644 --- a/generators/go/internal/testdata/sdk/bytes/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/bytes/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/client-options-core/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/client-options-core/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/client-options-core/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/client-options-core/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/client-options-core/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/client-options-core/fixtures/internal/retrier_test.go index 09b6795693de..e8ad977569f7 100644 --- a/generators/go/internal/testdata/sdk/client-options-core/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/client-options-core/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/client-options-filename/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/client-options-filename/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/client-options-filename/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/client-options-filename/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/client-options-filename/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/client-options-filename/fixtures/internal/retrier_test.go index 72b715db4dda..e016079a9446 100644 --- a/generators/go/internal/testdata/sdk/client-options-filename/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/client-options-filename/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/cycle/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/cycle/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/cycle/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/cycle/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/cycle/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/cycle/fixtures/internal/retrier_test.go index 8189612b6e91..39f666401cd1 100644 --- a/generators/go/internal/testdata/sdk/cycle/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/cycle/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/default/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/default/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/default/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/default/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/default/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/default/fixtures/internal/retrier_test.go index fc950bfc758b..055c3b0d46fd 100644 --- a/generators/go/internal/testdata/sdk/default/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/default/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/docs/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/docs/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/docs/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/docs/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/docs/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/docs/fixtures/internal/retrier_test.go index c5c70d09ee53..179f3840a110 100644 --- a/generators/go/internal/testdata/sdk/docs/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/docs/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/download/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/download/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/download/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/download/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/download/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/download/fixtures/internal/retrier_test.go index 85060f4e024d..a7c536876bc5 100644 --- a/generators/go/internal/testdata/sdk/download/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/download/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/empty/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/empty/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/empty/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/empty/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/empty/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/empty/fixtures/internal/retrier_test.go index 135e13b681a6..8259283c997f 100644 --- a/generators/go/internal/testdata/sdk/empty/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/empty/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/environments-core/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/environments-core/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/environments-core/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/environments-core/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/environments-core/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/environments-core/fixtures/internal/retrier_test.go index 0092bfd83ed2..303d5db9db87 100644 --- a/generators/go/internal/testdata/sdk/environments-core/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/environments-core/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/environments/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/environments/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/environments/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/environments/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/environments/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/environments/fixtures/internal/retrier_test.go index fc5a0037dc1e..2856ea12d8ff 100644 --- a/generators/go/internal/testdata/sdk/environments/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/environments/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/error-discrimination/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/error-discrimination/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/error-discrimination/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/error-discrimination/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/error-discrimination/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/error-discrimination/fixtures/internal/retrier_test.go index 4b1579759dd8..bce2b362af63 100644 --- a/generators/go/internal/testdata/sdk/error-discrimination/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/error-discrimination/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/error/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/error/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/error/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/error/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/error/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/error/fixtures/internal/retrier_test.go index 7c39b50356ef..92a3c91732ca 100644 --- a/generators/go/internal/testdata/sdk/error/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/error/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/headers/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/headers/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/headers/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/headers/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/headers/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/headers/fixtures/internal/retrier_test.go index 456d4d0ab22b..2026aa50c011 100644 --- a/generators/go/internal/testdata/sdk/headers/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/headers/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/mergent/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/mergent/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/mergent/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/mergent/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/mergent/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/mergent/fixtures/internal/retrier_test.go index 5f7ef093a5d6..2811c841f7e2 100644 --- a/generators/go/internal/testdata/sdk/mergent/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/mergent/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/multi-environments/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/multi-environments/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/multi-environments/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/multi-environments/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/multi-environments/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/multi-environments/fixtures/internal/retrier_test.go index c3288ef60ae0..ba0860e77f35 100644 --- a/generators/go/internal/testdata/sdk/multi-environments/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/multi-environments/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/optional-core/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/optional-core/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/optional-core/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/optional-core/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/optional-core/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/optional-core/fixtures/internal/retrier_test.go index b0d20062f5a0..1a3b23d8f155 100644 --- a/generators/go/internal/testdata/sdk/optional-core/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/optional-core/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/optional-filename/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/optional-filename/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/optional-filename/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/optional-filename/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/optional-filename/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/optional-filename/fixtures/internal/retrier_test.go index c34ef6cb2309..344948634513 100644 --- a/generators/go/internal/testdata/sdk/optional-filename/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/optional-filename/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/optional-response/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/optional-response/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/optional-response/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/optional-response/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/optional-response/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/optional-response/fixtures/internal/retrier_test.go index d129509a7034..5427f7e812bc 100644 --- a/generators/go/internal/testdata/sdk/optional-response/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/optional-response/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/packages/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/packages/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/packages/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/packages/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/packages/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/packages/fixtures/internal/retrier_test.go index 6e9b7b0e04dd..5d48f47805d8 100644 --- a/generators/go/internal/testdata/sdk/packages/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/packages/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/path-and-query-params/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/path-and-query-params/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/path-and-query-params/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/path-and-query-params/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/path-and-query-params/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/path-and-query-params/fixtures/internal/retrier_test.go index 38f9081f2ea0..54d0974ef543 100644 --- a/generators/go/internal/testdata/sdk/path-and-query-params/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/path-and-query-params/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/path-params/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/path-params/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/path-params/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/path-params/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/path-params/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/path-params/fixtures/internal/retrier_test.go index a4a55b41b2e6..2b4cf1a88565 100644 --- a/generators/go/internal/testdata/sdk/path-params/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/path-params/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/platform-headers/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/platform-headers/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/platform-headers/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/platform-headers/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/platform-headers/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/platform-headers/fixtures/internal/retrier_test.go index 1fb852876e3a..0d18d3b85071 100644 --- a/generators/go/internal/testdata/sdk/platform-headers/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/platform-headers/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/pointer-core/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/pointer-core/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/pointer-core/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/pointer-core/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/pointer-core/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/pointer-core/fixtures/internal/retrier_test.go index 28d7403fcd91..22244ffe5348 100644 --- a/generators/go/internal/testdata/sdk/pointer-core/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/pointer-core/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/pointer-filename/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/pointer-filename/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/pointer-filename/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/pointer-filename/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/pointer-filename/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/pointer-filename/fixtures/internal/retrier_test.go index 3199be820366..3baf9b8a7df2 100644 --- a/generators/go/internal/testdata/sdk/pointer-filename/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/pointer-filename/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/post-with-path-params-generics/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/post-with-path-params-generics/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/post-with-path-params-generics/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/post-with-path-params-generics/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/post-with-path-params-generics/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/post-with-path-params-generics/fixtures/internal/retrier_test.go index d87aef35e413..603651bcfbb9 100644 --- a/generators/go/internal/testdata/sdk/post-with-path-params-generics/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/post-with-path-params-generics/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/post-with-path-params/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/post-with-path-params/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/post-with-path-params/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/post-with-path-params/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/post-with-path-params/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/post-with-path-params/fixtures/internal/retrier_test.go index 1c4e74a9abae..5e545a95b483 100644 --- a/generators/go/internal/testdata/sdk/post-with-path-params/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/post-with-path-params/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/query-params-complex/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/query-params-complex/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/query-params-complex/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/query-params-complex/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/query-params-complex/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/query-params-complex/fixtures/internal/retrier_test.go index f8f32c506efa..836f896e7847 100644 --- a/generators/go/internal/testdata/sdk/query-params-complex/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/query-params-complex/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/query-params-multiple/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/query-params-multiple/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/query-params-multiple/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/query-params-multiple/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/query-params-multiple/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/query-params-multiple/fixtures/internal/retrier_test.go index c3efd157645f..9bbc349f6d85 100644 --- a/generators/go/internal/testdata/sdk/query-params-multiple/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/query-params-multiple/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/query-params/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/query-params/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/query-params/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/query-params/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/query-params/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/query-params/fixtures/internal/retrier_test.go index d329f6a9c671..7f7aed4505e7 100644 --- a/generators/go/internal/testdata/sdk/query-params/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/query-params/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/root/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/root/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/root/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/root/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/root/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/root/fixtures/internal/retrier_test.go index 61cbb85a2d81..901eb36bf6cf 100644 --- a/generators/go/internal/testdata/sdk/root/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/root/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/internal/testdata/sdk/upload/fixtures/internal/retrier.go b/generators/go/internal/testdata/sdk/upload/fixtures/internal/retrier.go index 3418f0094260..f013056901ab 100644 --- a/generators/go/internal/testdata/sdk/upload/fixtures/internal/retrier.go +++ b/generators/go/internal/testdata/sdk/upload/fixtures/internal/retrier.go @@ -130,7 +130,7 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode >= http.StatusInternalServerError + (response.StatusCode > http.StatusInternalServerError && response.StatusCode < 600) } // retryDelay calculates the delay time in milliseconds based on the retry attempt. diff --git a/generators/go/internal/testdata/sdk/upload/fixtures/internal/retrier_test.go b/generators/go/internal/testdata/sdk/upload/fixtures/internal/retrier_test.go index c305f9899d61..df298bb0c519 100644 --- a/generators/go/internal/testdata/sdk/upload/fixtures/internal/retrier_test.go +++ b/generators/go/internal/testdata/sdk/upload/fixtures/internal/retrier_test.go @@ -84,9 +84,24 @@ func TestRetrier(t *testing.T) { giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, }, { - description: "retries occur on status code 500", + description: "retries occur on status code 502", giveAttempts: 2, - giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + giveStatusCodes: []int{http.StatusBadGateway, http.StatusOK}, + }, + { + description: "no retries on status code 500", + giveAttempts: 1, + giveStatusCodes: []int{http.StatusInternalServerError}, + }, + { + description: "retries occur on status code 501", + giveAttempts: 2, + giveStatusCodes: []int{501, http.StatusOK}, + }, + { + description: "retries occur on status code 599", + giveAttempts: 2, + giveStatusCodes: []int{599, http.StatusOK}, }, } diff --git a/generators/go/sdk/changes/unreleased/fix-retry-status-codes.yml b/generators/go/sdk/changes/unreleased/fix-retry-status-codes.yml new file mode 100644 index 000000000000..e8cbf94cd3a7 --- /dev/null +++ b/generators/go/sdk/changes/unreleased/fix-retry-status-codes.yml @@ -0,0 +1,6 @@ +- summary: | + Add `retryStatusCodes` config with `"legacy"` and `"recommended"` modes. Legacy (default) + preserves current behavior (408, 429, >= 500). Recommended retries only transient + codes (408, 429, 502, 503, 504), avoiding idempotency issues with 500. A 1.0.0 + migration auto-pins legacy for upgrading users. + type: feat diff --git a/packages/generator-migrations/src/__test__/index.test.ts b/packages/generator-migrations/src/__test__/index.test.ts index 08d14cf8656c..f1eeb29133f1 100644 --- a/packages/generator-migrations/src/__test__/index.test.ts +++ b/packages/generator-migrations/src/__test__/index.test.ts @@ -89,6 +89,21 @@ describe("@fern-api/generator-migrations", () => { }); }); + describe("Go SDK migrations", () => { + it("includes Go SDK migration entries", () => { + expect(migrations["fernapi/fern-go-sdk"]).toBeDefined(); + expect(migrations["fernapi/fern-go-sdk"]?.migrations).toBeDefined(); + expect(Array.isArray(migrations["fernapi/fern-go-sdk"]?.migrations)).toBe(true); + }); + + it("Go SDK migrations are in semver order", () => { + const module = migrations["fernapi/fern-go-sdk"]; + const versions = module?.migrations.map((m) => m.version) ?? []; + + expect(versions).toEqual(["1.0.0"]); + }); + }); + describe("Java SDK migrations", () => { it("includes Java SDK migration entries", () => { expect(migrations["fernapi/fern-java-sdk"]).toBeDefined(); @@ -220,7 +235,7 @@ describe("@fern-api/generator-migrations", () => { describe("generator name lookup", () => { it("returns undefined for generators without migrations", () => { - expect(migrations["fernapi/fern-go-sdk"]).toBeUndefined(); + expect(migrations["fernapi/fern-swift-sdk"]).toBeUndefined(); }); it("requires full generator name with fernapi prefix", () => { diff --git a/packages/generator-migrations/src/generators/go/migrations/1.0.0.ts b/packages/generator-migrations/src/generators/go/migrations/1.0.0.ts new file mode 100644 index 000000000000..b5498651fec5 --- /dev/null +++ b/packages/generator-migrations/src/generators/go/migrations/1.0.0.ts @@ -0,0 +1,23 @@ +import type { Migration } from "@fern-api/migrations-base"; +import { migrateConfig } from "@fern-api/migrations-base"; + +// Migration for version 1.0.0 +// +// Context: +// Version 1.0.0 changes the default retry status codes from `legacy` to `recommended`. +// Under `legacy`, all 5xx status codes (including 500) are retried along with 408 and 429. +// Under `recommended`, only 408, 429, 502, 503, and 504 are retried, avoiding +// idempotency issues when retrying non-transient errors like 500 Internal Server Error. +// +// This migration explicitly sets `retryStatusCodes: "legacy"` for users upgrading from +// pre-1.0.0 versions, preserving their current retry behavior. +export const migration_1_0_0: Migration = { + version: "1.0.0", + + migrateGeneratorConfig: ({ config }) => + migrateConfig(config, (draft) => { + draft.retryStatusCodes ??= "legacy"; + }), + + migrateGeneratorsYml: ({ document }) => document +}; diff --git a/packages/generator-migrations/src/generators/go/migrations/index.ts b/packages/generator-migrations/src/generators/go/migrations/index.ts new file mode 100644 index 000000000000..9653dca55b99 --- /dev/null +++ b/packages/generator-migrations/src/generators/go/migrations/index.ts @@ -0,0 +1,20 @@ +import type { MigrationModule } from "@fern-api/migrations-base"; + +import { migration_1_0_0 } from "./1.0.0.js"; + +/** + * Migration module for Go SDK generator. + * + * This module contains migrations for configuration changes for + * the Go SDK generator: + * - fernapi/fern-go-sdk + * + * Each migration is defined in a separate file under this directory. + * Migrations are automatically applied by the Fern CLI when running: + * `fern generator upgrade --generator go-sdk` + */ +const migrationModule: MigrationModule = { + migrations: [migration_1_0_0] +}; + +export default migrationModule; diff --git a/packages/generator-migrations/src/index.ts b/packages/generator-migrations/src/index.ts index 74bbda6cfc9d..a552a77766ac 100644 --- a/packages/generator-migrations/src/index.ts +++ b/packages/generator-migrations/src/index.ts @@ -8,6 +8,7 @@ import type { MigrationModule } from "@fern-api/migrations-base"; import csharpSdkMigrations from "./generators/csharp/migrations/index.js"; +import goSdkMigrations from "./generators/go/migrations/index.js"; import javaSdkMigrations from "./generators/java/migrations/index.js"; import javaModelMigrations from "./generators/java-model/migrations/index.js"; import pythonSdkMigrations from "./generators/python/migrations/index.js"; @@ -27,6 +28,10 @@ export const migrations: Record = { // C# SDK "fernapi/fern-csharp-sdk": csharpSdkMigrations, + // Go SDK + "fernapi/fern-go-sdk": goSdkMigrations, + "fernapi/fern-go-model": goSdkMigrations, + // Java Model - both model and spring generators share the same migrations "fernapi/fern-java-model": javaModelMigrations, "fernapi/fern-java-spring": javaModelMigrations, From 92c4571cbe7add15942010b5e9cc44ffa513a77c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 15:05:50 +0000 Subject: [PATCH 08/43] chore(go): release 1.39.0 --- .../{unreleased => 1.39.0}/fix-retry-status-codes.yml | 0 generators/go/sdk/versions.yml | 10 ++++++++++ 2 files changed, 10 insertions(+) rename generators/go/sdk/changes/{unreleased => 1.39.0}/fix-retry-status-codes.yml (100%) diff --git a/generators/go/sdk/changes/unreleased/fix-retry-status-codes.yml b/generators/go/sdk/changes/1.39.0/fix-retry-status-codes.yml similarity index 100% rename from generators/go/sdk/changes/unreleased/fix-retry-status-codes.yml rename to generators/go/sdk/changes/1.39.0/fix-retry-status-codes.yml diff --git a/generators/go/sdk/versions.yml b/generators/go/sdk/versions.yml index 4223f5acd9ee..e5608a5e57d6 100644 --- a/generators/go/sdk/versions.yml +++ b/generators/go/sdk/versions.yml @@ -1,4 +1,14 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 1.39.0 + changelogEntry: + - summary: | + Add `retryStatusCodes` config with `"legacy"` and `"recommended"` modes. Legacy (default) + preserves current behavior (408, 429, >= 500). Recommended retries only transient + codes (408, 429, 502, 503, 504), avoiding idempotency issues with 500. A 1.0.0 + migration auto-pins legacy for upgrading users. + type: feat + createdAt: "2026-04-29" + irVersion: 66 - version: 1.38.3 changelogEntry: - summary: | From 6c3bf2d608add0c9bbd4eb3175d1dd06564d81cb Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 11:15:41 -0400 Subject: [PATCH 09/43] chore(ruby): update ruby-sdk-v2 seed (#15562) --- seed/ruby-sdk-v2/accept-header/README.md | 7 ++- seed/ruby-sdk-v2/alias-extends/README.md | 7 ++- seed/ruby-sdk-v2/alias/README.md | 7 ++- seed/ruby-sdk-v2/allof-inline/README.md | 7 ++- seed/ruby-sdk-v2/allof/README.md | 7 ++- seed/ruby-sdk-v2/any-auth/README.md | 7 ++- seed/ruby-sdk-v2/api-wide-base-path/README.md | 7 ++- seed/ruby-sdk-v2/audiences/README.md | 7 ++- .../README.md | 7 ++- .../wire-tests/README.md | 7 ++- .../basic-auth/wire-tests/README.md | 7 ++- .../README.md | 7 ++- seed/ruby-sdk-v2/bytes-download/README.md | 7 ++- seed/ruby-sdk-v2/bytes-upload/README.md | 7 ++- seed/ruby-sdk-v2/client-side-params/README.md | 7 ++- seed/ruby-sdk-v2/content-type/README.md | 7 ++- .../cross-package-type-names/README.md | 7 ++- .../endpoint-security-auth/README.md | 7 ++- seed/ruby-sdk-v2/enum/README.md | 7 ++- seed/ruby-sdk-v2/error-property/README.md | 7 ++- seed/ruby-sdk-v2/errors/README.md | 7 ++- .../examples/no-custom-config/README.md | 7 ++- .../examples/omit-fern-headers/README.md | 7 ++- .../examples/readme-config/README.md | 7 ++- .../examples/require-paths/README.md | 7 ++- .../ruby-sdk-v2/examples/wire-tests/README.md | 7 ++- .../exhaustive/wire-tests/README.md | 7 ++- seed/ruby-sdk-v2/extends/README.md | 7 ++- seed/ruby-sdk-v2/extra-properties/README.md | 7 ++- seed/ruby-sdk-v2/file-download/README.md | 7 ++- .../ruby-sdk-v2/file-upload-openapi/README.md | 7 ++- seed/ruby-sdk-v2/file-upload/README.md | 7 ++- seed/ruby-sdk-v2/folders/README.md | 7 ++- .../README.md | 7 ++- seed/ruby-sdk-v2/header-auth/README.md | 7 ++- seed/ruby-sdk-v2/http-head/README.md | 7 ++- .../ruby-sdk-v2/idempotency-headers/README.md | 7 ++- seed/ruby-sdk-v2/imdb/README.md | 7 ++- .../inferred-auth-explicit/README.md | 7 ++- .../inferred-auth-implicit-api-key/README.md | 7 ++- .../README.md | 7 ++- .../README.md | 7 ++- .../inferred-auth-implicit/README.md | 7 ++- seed/ruby-sdk-v2/license/README.md | 7 ++- seed/ruby-sdk-v2/literal/README.md | 7 ++- seed/ruby-sdk-v2/mixed-case/README.md | 7 ++- .../mixed-file-directory/README.md | 7 ++- seed/ruby-sdk-v2/multi-line-docs/README.md | 7 ++- .../README.md | 7 ++- .../multi-url-environment-reference/README.md | 7 ++- .../multi-url-environment/README.md | 7 ++- .../multiple-request-bodies/README.md | 7 ++- .../ruby-sdk-v2/no-content-response/README.md | 7 ++- seed/ruby-sdk-v2/no-environment/README.md | 7 ++- seed/ruby-sdk-v2/no-retries/README.md | 7 ++- seed/ruby-sdk-v2/null-type/README.md | 7 ++- .../nullable-allof-extends/README.md | 7 ++- seed/ruby-sdk-v2/nullable-optional/README.md | 7 ++- .../nullable-request-body/README.md | 7 ++- seed/ruby-sdk-v2/nullable/README.md | 7 ++- .../oauth-client-credentials-custom/README.md | 7 ++- .../README.md | 7 ++- .../README.md | 7 ++- .../README.md | 7 ++- .../README.md | 7 ++- .../README.md | 7 ++- .../README.md | 7 ++- .../README.md | 7 ++- .../oauth-client-credentials/README.md | 7 ++- .../openapi-request-body-ref/README.md | 7 ++- .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ seed/ruby-sdk-v2/optional/README.md | 7 ++- seed/ruby-sdk-v2/package-yml/README.md | 7 ++- seed/ruby-sdk-v2/pagination-custom/README.md | 7 ++- .../ruby-sdk-v2/pagination-uri-path/README.md | 7 ++- .../pagination/no-custom-config/README.md | 7 ++- .../pagination/page-index-semantics/README.md | 7 ++- seed/ruby-sdk-v2/path-parameters/README.md | 7 ++- seed/ruby-sdk-v2/plain-text/README.md | 7 ++- seed/ruby-sdk-v2/property-access/README.md | 7 ++- .../query-param-name-conflict/README.md | 7 ++- .../README.md | 7 ++- .../query-parameters-openapi/README.md | 7 ++- seed/ruby-sdk-v2/query-parameters/README.md | 7 ++- seed/ruby-sdk-v2/request-parameters/README.md | 7 ++- seed/ruby-sdk-v2/required-nullable/README.md | 7 ++- seed/ruby-sdk-v2/reserved-keywords/README.md | 7 ++- seed/ruby-sdk-v2/response-property/README.md | 7 ++- .../ruby-reserved-word-properties/README.md | 7 ++- .../README.md | 7 ++- .../server-sent-event-examples/README.md | 7 ++- .../server-sent-events-openapi/README.md | 7 ++- seed/ruby-sdk-v2/server-sent-events/README.md | 7 ++- .../server-url-templating/README.md | 7 ++- seed/ruby-sdk-v2/simple-api/README.md | 7 ++- seed/ruby-sdk-v2/simple-fhir/README.md | 7 ++- .../single-url-environment-default/README.md | 7 ++- .../README.md | 7 ++- .../ruby-sdk-v2/streaming-parameter/README.md | 7 ++- seed/ruby-sdk-v2/streaming/README.md | 7 ++- seed/ruby-sdk-v2/trace/README.md | 7 ++- .../README.md | 7 ++- .../undiscriminated-unions/README.md | 7 ++- .../union-query-parameters/README.md | 7 ++- .../unit/internal/http/test_raw_client.rb | 57 +++++++++++++++++++ .../unions-with-local-date/README.md | 7 ++- seed/ruby-sdk-v2/unions/README.md | 7 ++- seed/ruby-sdk-v2/unknown/README.md | 7 ++- seed/ruby-sdk-v2/url-form-encoded/README.md | 7 ++- seed/ruby-sdk-v2/validation/README.md | 7 ++- seed/ruby-sdk-v2/variables/README.md | 7 ++- seed/ruby-sdk-v2/version-no-default/README.md | 7 ++- seed/ruby-sdk-v2/version/README.md | 7 ++- .../websocket-inferred-auth/README.md | 7 ++- seed/ruby-sdk-v2/x-fern-default/README.md | 7 ++- 115 files changed, 792 insertions(+), 113 deletions(-) create mode 100644 seed/ruby-sdk-v2/openapi-request-body-ref/test/unit/internal/http/test_raw_client.rb create mode 100644 seed/ruby-sdk-v2/union-query-parameters/test/unit/internal/http/test_raw_client.rb diff --git a/seed/ruby-sdk-v2/accept-header/README.md b/seed/ruby-sdk-v2/accept-header/README.md index e48796c40f03..ccd90ba2e288 100644 --- a/seed/ruby-sdk-v2/accept-header/README.md +++ b/seed/ruby-sdk-v2/accept-header/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/alias-extends/README.md b/seed/ruby-sdk-v2/alias-extends/README.md index a3386bfd6907..ecfc5544c6bb 100644 --- a/seed/ruby-sdk-v2/alias-extends/README.md +++ b/seed/ruby-sdk-v2/alias-extends/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/alias/README.md b/seed/ruby-sdk-v2/alias/README.md index b4b1b0271739..a55ba069e17c 100644 --- a/seed/ruby-sdk-v2/alias/README.md +++ b/seed/ruby-sdk-v2/alias/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/allof-inline/README.md b/seed/ruby-sdk-v2/allof-inline/README.md index 8c9724fb7644..3f22e72b196b 100644 --- a/seed/ruby-sdk-v2/allof-inline/README.md +++ b/seed/ruby-sdk-v2/allof-inline/README.md @@ -94,7 +94,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/allof/README.md b/seed/ruby-sdk-v2/allof/README.md index 8c9724fb7644..3f22e72b196b 100644 --- a/seed/ruby-sdk-v2/allof/README.md +++ b/seed/ruby-sdk-v2/allof/README.md @@ -94,7 +94,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/any-auth/README.md b/seed/ruby-sdk-v2/any-auth/README.md index ddadb49ca341..785ce693d782 100644 --- a/seed/ruby-sdk-v2/any-auth/README.md +++ b/seed/ruby-sdk-v2/any-auth/README.md @@ -88,7 +88,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/api-wide-base-path/README.md b/seed/ruby-sdk-v2/api-wide-base-path/README.md index 0c92dada190f..b2d0e33b27d3 100644 --- a/seed/ruby-sdk-v2/api-wide-base-path/README.md +++ b/seed/ruby-sdk-v2/api-wide-base-path/README.md @@ -87,7 +87,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/audiences/README.md b/seed/ruby-sdk-v2/audiences/README.md index 62a1fb09aae6..cfca6b078831 100644 --- a/seed/ruby-sdk-v2/audiences/README.md +++ b/seed/ruby-sdk-v2/audiences/README.md @@ -95,7 +95,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/basic-auth-environment-variables/README.md b/seed/ruby-sdk-v2/basic-auth-environment-variables/README.md index 6c1c71ac7b31..941eed491a0a 100644 --- a/seed/ruby-sdk-v2/basic-auth-environment-variables/README.md +++ b/seed/ruby-sdk-v2/basic-auth-environment-variables/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/basic-auth-pw-omitted/wire-tests/README.md b/seed/ruby-sdk-v2/basic-auth-pw-omitted/wire-tests/README.md index cae405dd15b1..b32c68ae4444 100644 --- a/seed/ruby-sdk-v2/basic-auth-pw-omitted/wire-tests/README.md +++ b/seed/ruby-sdk-v2/basic-auth-pw-omitted/wire-tests/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/basic-auth/wire-tests/README.md b/seed/ruby-sdk-v2/basic-auth/wire-tests/README.md index 39dcc2ae12d7..7982a43d6718 100644 --- a/seed/ruby-sdk-v2/basic-auth/wire-tests/README.md +++ b/seed/ruby-sdk-v2/basic-auth/wire-tests/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/bearer-token-environment-variable/README.md b/seed/ruby-sdk-v2/bearer-token-environment-variable/README.md index 79908ab3f140..f404b96d60d4 100644 --- a/seed/ruby-sdk-v2/bearer-token-environment-variable/README.md +++ b/seed/ruby-sdk-v2/bearer-token-environment-variable/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/bytes-download/README.md b/seed/ruby-sdk-v2/bytes-download/README.md index 39f12e523fea..450e798adfcb 100644 --- a/seed/ruby-sdk-v2/bytes-download/README.md +++ b/seed/ruby-sdk-v2/bytes-download/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/bytes-upload/README.md b/seed/ruby-sdk-v2/bytes-upload/README.md index 5a16e2dc3653..efa8257e390b 100644 --- a/seed/ruby-sdk-v2/bytes-upload/README.md +++ b/seed/ruby-sdk-v2/bytes-upload/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/client-side-params/README.md b/seed/ruby-sdk-v2/client-side-params/README.md index fd7d821fc351..a128e54faa64 100644 --- a/seed/ruby-sdk-v2/client-side-params/README.md +++ b/seed/ruby-sdk-v2/client-side-params/README.md @@ -88,7 +88,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/content-type/README.md b/seed/ruby-sdk-v2/content-type/README.md index f75d92eeabcb..50a9b1fe3591 100644 --- a/seed/ruby-sdk-v2/content-type/README.md +++ b/seed/ruby-sdk-v2/content-type/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/cross-package-type-names/README.md b/seed/ruby-sdk-v2/cross-package-type-names/README.md index f2cd712be8eb..a8b463da12c9 100644 --- a/seed/ruby-sdk-v2/cross-package-type-names/README.md +++ b/seed/ruby-sdk-v2/cross-package-type-names/README.md @@ -87,7 +87,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/endpoint-security-auth/README.md b/seed/ruby-sdk-v2/endpoint-security-auth/README.md index ddadb49ca341..785ce693d782 100644 --- a/seed/ruby-sdk-v2/endpoint-security-auth/README.md +++ b/seed/ruby-sdk-v2/endpoint-security-auth/README.md @@ -88,7 +88,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/enum/README.md b/seed/ruby-sdk-v2/enum/README.md index a4d7ddb96684..54fe282d450c 100644 --- a/seed/ruby-sdk-v2/enum/README.md +++ b/seed/ruby-sdk-v2/enum/README.md @@ -87,7 +87,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/error-property/README.md b/seed/ruby-sdk-v2/error-property/README.md index 3d889308bf9b..706a8ef39ffc 100644 --- a/seed/ruby-sdk-v2/error-property/README.md +++ b/seed/ruby-sdk-v2/error-property/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/errors/README.md b/seed/ruby-sdk-v2/errors/README.md index f87cffe0d966..84b460cc824b 100644 --- a/seed/ruby-sdk-v2/errors/README.md +++ b/seed/ruby-sdk-v2/errors/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/examples/no-custom-config/README.md b/seed/ruby-sdk-v2/examples/no-custom-config/README.md index 97c02cef0af8..0f64c52de8b1 100644 --- a/seed/ruby-sdk-v2/examples/no-custom-config/README.md +++ b/seed/ruby-sdk-v2/examples/no-custom-config/README.md @@ -91,7 +91,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/examples/omit-fern-headers/README.md b/seed/ruby-sdk-v2/examples/omit-fern-headers/README.md index 97c02cef0af8..0f64c52de8b1 100644 --- a/seed/ruby-sdk-v2/examples/omit-fern-headers/README.md +++ b/seed/ruby-sdk-v2/examples/omit-fern-headers/README.md @@ -91,7 +91,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/examples/readme-config/README.md b/seed/ruby-sdk-v2/examples/readme-config/README.md index 5194d04e417c..dbb97453aee4 100644 --- a/seed/ruby-sdk-v2/examples/readme-config/README.md +++ b/seed/ruby-sdk-v2/examples/readme-config/README.md @@ -242,7 +242,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/examples/require-paths/README.md b/seed/ruby-sdk-v2/examples/require-paths/README.md index 97c02cef0af8..0f64c52de8b1 100644 --- a/seed/ruby-sdk-v2/examples/require-paths/README.md +++ b/seed/ruby-sdk-v2/examples/require-paths/README.md @@ -91,7 +91,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/examples/wire-tests/README.md b/seed/ruby-sdk-v2/examples/wire-tests/README.md index 97c02cef0af8..0f64c52de8b1 100644 --- a/seed/ruby-sdk-v2/examples/wire-tests/README.md +++ b/seed/ruby-sdk-v2/examples/wire-tests/README.md @@ -91,7 +91,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/exhaustive/wire-tests/README.md b/seed/ruby-sdk-v2/exhaustive/wire-tests/README.md index a9c4d5e09dff..cff9d9e88cad 100644 --- a/seed/ruby-sdk-v2/exhaustive/wire-tests/README.md +++ b/seed/ruby-sdk-v2/exhaustive/wire-tests/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/extends/README.md b/seed/ruby-sdk-v2/extends/README.md index b7ec00cf10f2..19345301bced 100644 --- a/seed/ruby-sdk-v2/extends/README.md +++ b/seed/ruby-sdk-v2/extends/README.md @@ -87,7 +87,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/extra-properties/README.md b/seed/ruby-sdk-v2/extra-properties/README.md index a16499b85655..e0065c786e68 100644 --- a/seed/ruby-sdk-v2/extra-properties/README.md +++ b/seed/ruby-sdk-v2/extra-properties/README.md @@ -87,7 +87,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/file-download/README.md b/seed/ruby-sdk-v2/file-download/README.md index 39f12e523fea..450e798adfcb 100644 --- a/seed/ruby-sdk-v2/file-download/README.md +++ b/seed/ruby-sdk-v2/file-download/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/file-upload-openapi/README.md b/seed/ruby-sdk-v2/file-upload-openapi/README.md index de13bf441a46..15d99f4e9952 100644 --- a/seed/ruby-sdk-v2/file-upload-openapi/README.md +++ b/seed/ruby-sdk-v2/file-upload-openapi/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/file-upload/README.md b/seed/ruby-sdk-v2/file-upload/README.md index 5403b386d1ed..d58f608dd8eb 100644 --- a/seed/ruby-sdk-v2/file-upload/README.md +++ b/seed/ruby-sdk-v2/file-upload/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/folders/README.md b/seed/ruby-sdk-v2/folders/README.md index 0567253e99d9..9d46806fca99 100644 --- a/seed/ruby-sdk-v2/folders/README.md +++ b/seed/ruby-sdk-v2/folders/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/header-auth-environment-variable/README.md b/seed/ruby-sdk-v2/header-auth-environment-variable/README.md index a84cae2e5fbc..e0663e1de398 100644 --- a/seed/ruby-sdk-v2/header-auth-environment-variable/README.md +++ b/seed/ruby-sdk-v2/header-auth-environment-variable/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/header-auth/README.md b/seed/ruby-sdk-v2/header-auth/README.md index e9977857dac0..0adbcd104f4d 100644 --- a/seed/ruby-sdk-v2/header-auth/README.md +++ b/seed/ruby-sdk-v2/header-auth/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/http-head/README.md b/seed/ruby-sdk-v2/http-head/README.md index a827ba657e2a..433feb89e29d 100644 --- a/seed/ruby-sdk-v2/http-head/README.md +++ b/seed/ruby-sdk-v2/http-head/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/idempotency-headers/README.md b/seed/ruby-sdk-v2/idempotency-headers/README.md index 53fed3125898..a01646e9942f 100644 --- a/seed/ruby-sdk-v2/idempotency-headers/README.md +++ b/seed/ruby-sdk-v2/idempotency-headers/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/imdb/README.md b/seed/ruby-sdk-v2/imdb/README.md index 890bcd23267c..b3a94f1978a5 100644 --- a/seed/ruby-sdk-v2/imdb/README.md +++ b/seed/ruby-sdk-v2/imdb/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/inferred-auth-explicit/README.md b/seed/ruby-sdk-v2/inferred-auth-explicit/README.md index f41190c7349f..64cc76d5eb77 100644 --- a/seed/ruby-sdk-v2/inferred-auth-explicit/README.md +++ b/seed/ruby-sdk-v2/inferred-auth-explicit/README.md @@ -90,7 +90,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/inferred-auth-implicit-api-key/README.md b/seed/ruby-sdk-v2/inferred-auth-implicit-api-key/README.md index 1965fd8ae339..9ad48dc767fa 100644 --- a/seed/ruby-sdk-v2/inferred-auth-implicit-api-key/README.md +++ b/seed/ruby-sdk-v2/inferred-auth-implicit-api-key/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/inferred-auth-implicit-no-expiry/README.md b/seed/ruby-sdk-v2/inferred-auth-implicit-no-expiry/README.md index f41190c7349f..64cc76d5eb77 100644 --- a/seed/ruby-sdk-v2/inferred-auth-implicit-no-expiry/README.md +++ b/seed/ruby-sdk-v2/inferred-auth-implicit-no-expiry/README.md @@ -90,7 +90,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/inferred-auth-implicit-reference/README.md b/seed/ruby-sdk-v2/inferred-auth-implicit-reference/README.md index 3261ccf99a9b..96706996b31d 100644 --- a/seed/ruby-sdk-v2/inferred-auth-implicit-reference/README.md +++ b/seed/ruby-sdk-v2/inferred-auth-implicit-reference/README.md @@ -89,7 +89,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/inferred-auth-implicit/README.md b/seed/ruby-sdk-v2/inferred-auth-implicit/README.md index f41190c7349f..64cc76d5eb77 100644 --- a/seed/ruby-sdk-v2/inferred-auth-implicit/README.md +++ b/seed/ruby-sdk-v2/inferred-auth-implicit/README.md @@ -90,7 +90,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/license/README.md b/seed/ruby-sdk-v2/license/README.md index 6311930f1c5a..3789a85b69a7 100644 --- a/seed/ruby-sdk-v2/license/README.md +++ b/seed/ruby-sdk-v2/license/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/literal/README.md b/seed/ruby-sdk-v2/literal/README.md index b45aa6c41faf..9b503d313863 100644 --- a/seed/ruby-sdk-v2/literal/README.md +++ b/seed/ruby-sdk-v2/literal/README.md @@ -87,7 +87,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/mixed-case/README.md b/seed/ruby-sdk-v2/mixed-case/README.md index 66f9bc9d3fd2..4cbe5322502e 100644 --- a/seed/ruby-sdk-v2/mixed-case/README.md +++ b/seed/ruby-sdk-v2/mixed-case/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/mixed-file-directory/README.md b/seed/ruby-sdk-v2/mixed-file-directory/README.md index 0355e50675f1..00d8f9e5561b 100644 --- a/seed/ruby-sdk-v2/mixed-file-directory/README.md +++ b/seed/ruby-sdk-v2/mixed-file-directory/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/multi-line-docs/README.md b/seed/ruby-sdk-v2/multi-line-docs/README.md index 80726ef3c290..390354bbd1db 100644 --- a/seed/ruby-sdk-v2/multi-line-docs/README.md +++ b/seed/ruby-sdk-v2/multi-line-docs/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/multi-url-environment-no-default/README.md b/seed/ruby-sdk-v2/multi-url-environment-no-default/README.md index 2c8fc351741a..fa4191ddcb2f 100644 --- a/seed/ruby-sdk-v2/multi-url-environment-no-default/README.md +++ b/seed/ruby-sdk-v2/multi-url-environment-no-default/README.md @@ -91,7 +91,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/multi-url-environment-reference/README.md b/seed/ruby-sdk-v2/multi-url-environment-reference/README.md index 7a036f6c4029..ae2d9d414da3 100644 --- a/seed/ruby-sdk-v2/multi-url-environment-reference/README.md +++ b/seed/ruby-sdk-v2/multi-url-environment-reference/README.md @@ -94,7 +94,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/multi-url-environment/README.md b/seed/ruby-sdk-v2/multi-url-environment/README.md index 2c8fc351741a..fa4191ddcb2f 100644 --- a/seed/ruby-sdk-v2/multi-url-environment/README.md +++ b/seed/ruby-sdk-v2/multi-url-environment/README.md @@ -91,7 +91,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/multiple-request-bodies/README.md b/seed/ruby-sdk-v2/multiple-request-bodies/README.md index ac1828f92f81..18e40e332f89 100644 --- a/seed/ruby-sdk-v2/multiple-request-bodies/README.md +++ b/seed/ruby-sdk-v2/multiple-request-bodies/README.md @@ -91,7 +91,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/no-content-response/README.md b/seed/ruby-sdk-v2/no-content-response/README.md index 561a593bac96..802722edfd25 100644 --- a/seed/ruby-sdk-v2/no-content-response/README.md +++ b/seed/ruby-sdk-v2/no-content-response/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/no-environment/README.md b/seed/ruby-sdk-v2/no-environment/README.md index a9759b0a4dd3..a2636e4a970e 100644 --- a/seed/ruby-sdk-v2/no-environment/README.md +++ b/seed/ruby-sdk-v2/no-environment/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/no-retries/README.md b/seed/ruby-sdk-v2/no-retries/README.md index d031d3ae2f94..506faf7086b9 100644 --- a/seed/ruby-sdk-v2/no-retries/README.md +++ b/seed/ruby-sdk-v2/no-retries/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/null-type/README.md b/seed/ruby-sdk-v2/null-type/README.md index 9ee831ff6043..9188dd476a39 100644 --- a/seed/ruby-sdk-v2/null-type/README.md +++ b/seed/ruby-sdk-v2/null-type/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/nullable-allof-extends/README.md b/seed/ruby-sdk-v2/nullable-allof-extends/README.md index 2186c25fb813..b93540109c0a 100644 --- a/seed/ruby-sdk-v2/nullable-allof-extends/README.md +++ b/seed/ruby-sdk-v2/nullable-allof-extends/README.md @@ -91,7 +91,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/nullable-optional/README.md b/seed/ruby-sdk-v2/nullable-optional/README.md index 878021825240..69f6628041bc 100644 --- a/seed/ruby-sdk-v2/nullable-optional/README.md +++ b/seed/ruby-sdk-v2/nullable-optional/README.md @@ -96,7 +96,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/nullable-request-body/README.md b/seed/ruby-sdk-v2/nullable-request-body/README.md index 4423ed58c528..4cddcc445ca4 100644 --- a/seed/ruby-sdk-v2/nullable-request-body/README.md +++ b/seed/ruby-sdk-v2/nullable-request-body/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/nullable/README.md b/seed/ruby-sdk-v2/nullable/README.md index 3f3718e3bc01..7678d33b30ad 100644 --- a/seed/ruby-sdk-v2/nullable/README.md +++ b/seed/ruby-sdk-v2/nullable/README.md @@ -97,7 +97,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-custom/README.md b/seed/ruby-sdk-v2/oauth-client-credentials-custom/README.md index 8a6eb1c3a00d..74a5d78da199 100644 --- a/seed/ruby-sdk-v2/oauth-client-credentials-custom/README.md +++ b/seed/ruby-sdk-v2/oauth-client-credentials-custom/README.md @@ -94,7 +94,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-default/README.md b/seed/ruby-sdk-v2/oauth-client-credentials-default/README.md index 987f6422024f..9a1252063098 100644 --- a/seed/ruby-sdk-v2/oauth-client-credentials-default/README.md +++ b/seed/ruby-sdk-v2/oauth-client-credentials-default/README.md @@ -90,7 +90,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-environment-variables/README.md b/seed/ruby-sdk-v2/oauth-client-credentials-environment-variables/README.md index fde98e702340..0a167ba7195f 100644 --- a/seed/ruby-sdk-v2/oauth-client-credentials-environment-variables/README.md +++ b/seed/ruby-sdk-v2/oauth-client-credentials-environment-variables/README.md @@ -92,7 +92,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-mandatory-auth/README.md b/seed/ruby-sdk-v2/oauth-client-credentials-mandatory-auth/README.md index 423a51c43c40..7e85b84ef5b8 100644 --- a/seed/ruby-sdk-v2/oauth-client-credentials-mandatory-auth/README.md +++ b/seed/ruby-sdk-v2/oauth-client-credentials-mandatory-auth/README.md @@ -92,7 +92,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-nested-root/README.md b/seed/ruby-sdk-v2/oauth-client-credentials-nested-root/README.md index 2f8fe287910c..ac7bed368009 100644 --- a/seed/ruby-sdk-v2/oauth-client-credentials-nested-root/README.md +++ b/seed/ruby-sdk-v2/oauth-client-credentials-nested-root/README.md @@ -92,7 +92,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-openapi/README.md b/seed/ruby-sdk-v2/oauth-client-credentials-openapi/README.md index fa25ec516324..7f0921934536 100644 --- a/seed/ruby-sdk-v2/oauth-client-credentials-openapi/README.md +++ b/seed/ruby-sdk-v2/oauth-client-credentials-openapi/README.md @@ -89,7 +89,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-reference/README.md b/seed/ruby-sdk-v2/oauth-client-credentials-reference/README.md index f1c3301016c1..ab7c5c98f72c 100644 --- a/seed/ruby-sdk-v2/oauth-client-credentials-reference/README.md +++ b/seed/ruby-sdk-v2/oauth-client-credentials-reference/README.md @@ -89,7 +89,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/oauth-client-credentials-with-variables/README.md b/seed/ruby-sdk-v2/oauth-client-credentials-with-variables/README.md index fde98e702340..0a167ba7195f 100644 --- a/seed/ruby-sdk-v2/oauth-client-credentials-with-variables/README.md +++ b/seed/ruby-sdk-v2/oauth-client-credentials-with-variables/README.md @@ -92,7 +92,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/oauth-client-credentials/README.md b/seed/ruby-sdk-v2/oauth-client-credentials/README.md index 423a51c43c40..7e85b84ef5b8 100644 --- a/seed/ruby-sdk-v2/oauth-client-credentials/README.md +++ b/seed/ruby-sdk-v2/oauth-client-credentials/README.md @@ -92,7 +92,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/openapi-request-body-ref/README.md b/seed/ruby-sdk-v2/openapi-request-body-ref/README.md index ae781cbe6917..79d7a6316e06 100644 --- a/seed/ruby-sdk-v2/openapi-request-body-ref/README.md +++ b/seed/ruby-sdk-v2/openapi-request-body-ref/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/openapi-request-body-ref/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/openapi-request-body-ref/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/openapi-request-body-ref/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/optional/README.md b/seed/ruby-sdk-v2/optional/README.md index 1f273a45e6f7..c537bac392ca 100644 --- a/seed/ruby-sdk-v2/optional/README.md +++ b/seed/ruby-sdk-v2/optional/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/package-yml/README.md b/seed/ruby-sdk-v2/package-yml/README.md index 52e2b2544d95..0dcb8baa0a7a 100644 --- a/seed/ruby-sdk-v2/package-yml/README.md +++ b/seed/ruby-sdk-v2/package-yml/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/pagination-custom/README.md b/seed/ruby-sdk-v2/pagination-custom/README.md index 84bbdd52d388..dd1b7b1f3232 100644 --- a/seed/ruby-sdk-v2/pagination-custom/README.md +++ b/seed/ruby-sdk-v2/pagination-custom/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/pagination-uri-path/README.md b/seed/ruby-sdk-v2/pagination-uri-path/README.md index 10154e942935..87af38787ff5 100644 --- a/seed/ruby-sdk-v2/pagination-uri-path/README.md +++ b/seed/ruby-sdk-v2/pagination-uri-path/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/pagination/no-custom-config/README.md b/seed/ruby-sdk-v2/pagination/no-custom-config/README.md index 4852d26e01bb..9e1be8cee8e8 100644 --- a/seed/ruby-sdk-v2/pagination/no-custom-config/README.md +++ b/seed/ruby-sdk-v2/pagination/no-custom-config/README.md @@ -121,7 +121,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/pagination/page-index-semantics/README.md b/seed/ruby-sdk-v2/pagination/page-index-semantics/README.md index 4852d26e01bb..9e1be8cee8e8 100644 --- a/seed/ruby-sdk-v2/pagination/page-index-semantics/README.md +++ b/seed/ruby-sdk-v2/pagination/page-index-semantics/README.md @@ -121,7 +121,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/path-parameters/README.md b/seed/ruby-sdk-v2/path-parameters/README.md index 6c6fa4441d03..85f534f6fffa 100644 --- a/seed/ruby-sdk-v2/path-parameters/README.md +++ b/seed/ruby-sdk-v2/path-parameters/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/plain-text/README.md b/seed/ruby-sdk-v2/plain-text/README.md index 65eaf21a356a..379575026025 100644 --- a/seed/ruby-sdk-v2/plain-text/README.md +++ b/seed/ruby-sdk-v2/plain-text/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/property-access/README.md b/seed/ruby-sdk-v2/property-access/README.md index 85274f50876c..6fc8c881e487 100644 --- a/seed/ruby-sdk-v2/property-access/README.md +++ b/seed/ruby-sdk-v2/property-access/README.md @@ -94,7 +94,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/query-param-name-conflict/README.md b/seed/ruby-sdk-v2/query-param-name-conflict/README.md index bf50deb9f52f..513381636be2 100644 --- a/seed/ruby-sdk-v2/query-param-name-conflict/README.md +++ b/seed/ruby-sdk-v2/query-param-name-conflict/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/query-parameters-openapi-as-objects/README.md b/seed/ruby-sdk-v2/query-parameters-openapi-as-objects/README.md index 626c2e41796b..c9a8e2802cde 100644 --- a/seed/ruby-sdk-v2/query-parameters-openapi-as-objects/README.md +++ b/seed/ruby-sdk-v2/query-parameters-openapi-as-objects/README.md @@ -117,7 +117,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/query-parameters-openapi/README.md b/seed/ruby-sdk-v2/query-parameters-openapi/README.md index 626c2e41796b..c9a8e2802cde 100644 --- a/seed/ruby-sdk-v2/query-parameters-openapi/README.md +++ b/seed/ruby-sdk-v2/query-parameters-openapi/README.md @@ -117,7 +117,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/query-parameters/README.md b/seed/ruby-sdk-v2/query-parameters/README.md index 1313bd410fa4..90ecf7bea740 100644 --- a/seed/ruby-sdk-v2/query-parameters/README.md +++ b/seed/ruby-sdk-v2/query-parameters/README.md @@ -116,7 +116,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/request-parameters/README.md b/seed/ruby-sdk-v2/request-parameters/README.md index 79bd34b40424..b7ad9d356177 100644 --- a/seed/ruby-sdk-v2/request-parameters/README.md +++ b/seed/ruby-sdk-v2/request-parameters/README.md @@ -88,7 +88,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/required-nullable/README.md b/seed/ruby-sdk-v2/required-nullable/README.md index 682ab9373687..33432e0bbec9 100644 --- a/seed/ruby-sdk-v2/required-nullable/README.md +++ b/seed/ruby-sdk-v2/required-nullable/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/reserved-keywords/README.md b/seed/ruby-sdk-v2/reserved-keywords/README.md index 4c6e27c28d29..602dcea562e1 100644 --- a/seed/ruby-sdk-v2/reserved-keywords/README.md +++ b/seed/ruby-sdk-v2/reserved-keywords/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/response-property/README.md b/seed/ruby-sdk-v2/response-property/README.md index ac29bbddaeba..484048385852 100644 --- a/seed/ruby-sdk-v2/response-property/README.md +++ b/seed/ruby-sdk-v2/response-property/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/ruby-reserved-word-properties/README.md b/seed/ruby-sdk-v2/ruby-reserved-word-properties/README.md index dcdb1a442cff..e723bc92491c 100644 --- a/seed/ruby-sdk-v2/ruby-reserved-word-properties/README.md +++ b/seed/ruby-sdk-v2/ruby-reserved-word-properties/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/schemaless-request-body-examples/README.md b/seed/ruby-sdk-v2/schemaless-request-body-examples/README.md index 3f690cf60e17..abf0fe90a0b1 100644 --- a/seed/ruby-sdk-v2/schemaless-request-body-examples/README.md +++ b/seed/ruby-sdk-v2/schemaless-request-body-examples/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/README.md b/seed/ruby-sdk-v2/server-sent-event-examples/README.md index 900484f9fd7a..3cefa7dde408 100644 --- a/seed/ruby-sdk-v2/server-sent-event-examples/README.md +++ b/seed/ruby-sdk-v2/server-sent-event-examples/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/server-sent-events-openapi/README.md b/seed/ruby-sdk-v2/server-sent-events-openapi/README.md index f0328f9d03f2..a650eec14f93 100644 --- a/seed/ruby-sdk-v2/server-sent-events-openapi/README.md +++ b/seed/ruby-sdk-v2/server-sent-events-openapi/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/server-sent-events/README.md b/seed/ruby-sdk-v2/server-sent-events/README.md index 900484f9fd7a..3cefa7dde408 100644 --- a/seed/ruby-sdk-v2/server-sent-events/README.md +++ b/seed/ruby-sdk-v2/server-sent-events/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/server-url-templating/README.md b/seed/ruby-sdk-v2/server-url-templating/README.md index 56d0ec085b5f..c395250ed71e 100644 --- a/seed/ruby-sdk-v2/server-url-templating/README.md +++ b/seed/ruby-sdk-v2/server-url-templating/README.md @@ -94,7 +94,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/simple-api/README.md b/seed/ruby-sdk-v2/simple-api/README.md index 910d7e14a634..b9a96d223e14 100644 --- a/seed/ruby-sdk-v2/simple-api/README.md +++ b/seed/ruby-sdk-v2/simple-api/README.md @@ -91,7 +91,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/simple-fhir/README.md b/seed/ruby-sdk-v2/simple-fhir/README.md index 04775b7935c5..e53e10487dec 100644 --- a/seed/ruby-sdk-v2/simple-fhir/README.md +++ b/seed/ruby-sdk-v2/simple-fhir/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/single-url-environment-default/README.md b/seed/ruby-sdk-v2/single-url-environment-default/README.md index 60546c417c21..0cec836d2b18 100644 --- a/seed/ruby-sdk-v2/single-url-environment-default/README.md +++ b/seed/ruby-sdk-v2/single-url-environment-default/README.md @@ -91,7 +91,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/single-url-environment-no-default/README.md b/seed/ruby-sdk-v2/single-url-environment-no-default/README.md index 60546c417c21..0cec836d2b18 100644 --- a/seed/ruby-sdk-v2/single-url-environment-no-default/README.md +++ b/seed/ruby-sdk-v2/single-url-environment-no-default/README.md @@ -91,7 +91,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/streaming-parameter/README.md b/seed/ruby-sdk-v2/streaming-parameter/README.md index c9f11e05951e..98f7c517a945 100644 --- a/seed/ruby-sdk-v2/streaming-parameter/README.md +++ b/seed/ruby-sdk-v2/streaming-parameter/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/streaming/README.md b/seed/ruby-sdk-v2/streaming/README.md index c9fa02fabca4..ced6b50f8af0 100644 --- a/seed/ruby-sdk-v2/streaming/README.md +++ b/seed/ruby-sdk-v2/streaming/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/trace/README.md b/seed/ruby-sdk-v2/trace/README.md index 3d371a52e841..92fa302ac3b2 100644 --- a/seed/ruby-sdk-v2/trace/README.md +++ b/seed/ruby-sdk-v2/trace/README.md @@ -94,7 +94,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/undiscriminated-union-with-response-property/README.md b/seed/ruby-sdk-v2/undiscriminated-union-with-response-property/README.md index 39e4534b779f..143a2ea67e93 100644 --- a/seed/ruby-sdk-v2/undiscriminated-union-with-response-property/README.md +++ b/seed/ruby-sdk-v2/undiscriminated-union-with-response-property/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/undiscriminated-unions/README.md b/seed/ruby-sdk-v2/undiscriminated-unions/README.md index a6ccf5f758a0..20811023b591 100644 --- a/seed/ruby-sdk-v2/undiscriminated-unions/README.md +++ b/seed/ruby-sdk-v2/undiscriminated-unions/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/union-query-parameters/README.md b/seed/ruby-sdk-v2/union-query-parameters/README.md index 74cfede20460..eb98eaeddc27 100644 --- a/seed/ruby-sdk-v2/union-query-parameters/README.md +++ b/seed/ruby-sdk-v2/union-query-parameters/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/union-query-parameters/test/unit/internal/http/test_raw_client.rb b/seed/ruby-sdk-v2/union-query-parameters/test/unit/internal/http/test_raw_client.rb new file mode 100644 index 000000000000..cc6ce00adbb8 --- /dev/null +++ b/seed/ruby-sdk-v2/union-query-parameters/test/unit/internal/http/test_raw_client.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +describe Seed::Internal::Http::RawClient do + def make_response(status_code) + response = Minitest::Mock.new + response.expect(:code, status_code.to_s) + response + end + + describe "#should_retry?" do + let(:client) do + Seed::Internal::Http::RawClient.new(base_url: "https://example.com", max_retries: 3) + end + + it "retries on 408 Request Timeout" do + assert client.should_retry?(make_response(408), 0) + end + + it "retries on 429 Too Many Requests" do + assert client.should_retry?(make_response(429), 0) + end + + it "retries on retryable 5xx statuses" do + [500, 502, 503, 504, 521, 522, 524].each do |status| + assert client.should_retry?(make_response(status), 0), "expected retry for status #{status}" + end + end + + it "does not retry on non-retryable 5xx statuses" do + [501, 505, 510, 599].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 2xx success codes" do + [200, 201, 204].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry on 4xx other than 408 and 429" do + [400, 401, 403, 404, 422].each do |status| + refute client.should_retry?(make_response(status), 0), "expected no retry for status #{status}" + end + end + + it "does not retry when max retries is reached" do + refute client.should_retry?(make_response(502), 3) + end + + it "retries when attempt is below max retries" do + assert client.should_retry?(make_response(502), 2) + end + end +end diff --git a/seed/ruby-sdk-v2/unions-with-local-date/README.md b/seed/ruby-sdk-v2/unions-with-local-date/README.md index 4266b347cfe8..f9208d571673 100644 --- a/seed/ruby-sdk-v2/unions-with-local-date/README.md +++ b/seed/ruby-sdk-v2/unions-with-local-date/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/unions/README.md b/seed/ruby-sdk-v2/unions/README.md index 4266b347cfe8..f9208d571673 100644 --- a/seed/ruby-sdk-v2/unions/README.md +++ b/seed/ruby-sdk-v2/unions/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/unknown/README.md b/seed/ruby-sdk-v2/unknown/README.md index 76d0e9893292..dca0e474c311 100644 --- a/seed/ruby-sdk-v2/unknown/README.md +++ b/seed/ruby-sdk-v2/unknown/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/url-form-encoded/README.md b/seed/ruby-sdk-v2/url-form-encoded/README.md index 694682f1924e..21f7498c53d0 100644 --- a/seed/ruby-sdk-v2/url-form-encoded/README.md +++ b/seed/ruby-sdk-v2/url-form-encoded/README.md @@ -86,7 +86,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/validation/README.md b/seed/ruby-sdk-v2/validation/README.md index 7dc14fac1631..42829378a424 100644 --- a/seed/ruby-sdk-v2/validation/README.md +++ b/seed/ruby-sdk-v2/validation/README.md @@ -88,7 +88,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/variables/README.md b/seed/ruby-sdk-v2/variables/README.md index a171deb85d06..d762cdfb244d 100644 --- a/seed/ruby-sdk-v2/variables/README.md +++ b/seed/ruby-sdk-v2/variables/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/version-no-default/README.md b/seed/ruby-sdk-v2/version-no-default/README.md index 209e6726f3e7..2c80da2c93a5 100644 --- a/seed/ruby-sdk-v2/version-no-default/README.md +++ b/seed/ruby-sdk-v2/version-no-default/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/version/README.md b/seed/ruby-sdk-v2/version/README.md index 209e6726f3e7..2c80da2c93a5 100644 --- a/seed/ruby-sdk-v2/version/README.md +++ b/seed/ruby-sdk-v2/version/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/websocket-inferred-auth/README.md b/seed/ruby-sdk-v2/websocket-inferred-auth/README.md index f41190c7349f..64cc76d5eb77 100644 --- a/seed/ruby-sdk-v2/websocket-inferred-auth/README.md +++ b/seed/ruby-sdk-v2/websocket-inferred-auth/README.md @@ -90,7 +90,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. diff --git a/seed/ruby-sdk-v2/x-fern-default/README.md b/seed/ruby-sdk-v2/x-fern-default/README.md index dee519fd4ba9..f8b12c3bddda 100644 --- a/seed/ruby-sdk-v2/x-fern-default/README.md +++ b/seed/ruby-sdk-v2/x-fern-default/README.md @@ -83,7 +83,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `max_retries` option to configure this behavior. From b033c3e29e19ae8f2067f25303efe2378abf9828 Mon Sep 17 00:00:00 2001 From: Naman Anand Date: Wed, 29 Apr 2026 20:47:31 +0530 Subject: [PATCH 10/43] feat(swift): add config-driven retryStatusCodes with legacy/recommended modes (#15419) * fix(swift): only retry on 408, 429, and 5xx except 500 Updated shouldRetry to use (>= 501 && < 600) instead of >= 500. Updated retry tests: renamed testRetryOn500 to testRetryOn502BadGateway, added testNoRetryOn500InternalServerError, and changed testEndpointLevelMaxRetriesOverride to use 502. * fix: add 5XX hyperlink to features.yml to match TS PR pattern * fix(swift): update changelog wording and add 501/599 boundary tests * feat(swift): add config-driven retryStatusCodes with legacy/recommended modes - Add retryStatusCodes field to BaseSwiftCustomConfigSchema (legacy | recommended) - Legacy (default): 408, 429, >= 500 - Recommended: 408, 429, 502, 503, 504 (excludes 500 Internal Server Error) - Apply string replacement in SdkGeneratorCli.ts when config is recommended - Create 1.0.0 migration to auto-pin legacy for existing users - Register Swift SDK migrations in main index - Update features.yml documenting both modes - Revert seed HTTPClient.swift and ClientRetryTests.swift to legacy behavior * fix: mark @boundaryml/baml as external in swift build to prevent esbuild native module errors * refactor: use template variable for retryStatusCodes instead of find/replace * fix: drop @boundaryml/baml external from build.mjs (now in shared build-utils) * refactor(swift): use {{RETRY_STATUS_CHECK}} placeholder pattern like TS/Rust Replace EJS retryStatusCheck variable with {{RETRY_STATUS_CHECK}} placeholder resolved by SdkGeneratorCli.ts after EJS rendering, matching the identical pattern used in TS and Rust generators. * fix: update migration test - Swift SDK now has migrations --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../Sources/HTTPClient.Template.swift | 2 +- .../BaseSwiftCustomConfigSchema.ts | 3 +- .../unreleased/fix-retry-status-codes.yml | 6 ++++ generators/swift/sdk/features.yml | 20 +++++++++++++ generators/swift/sdk/src/SdkGeneratorCli.ts | 8 ++++- .../src/__test__/index.test.ts | 30 ++++++++++++++++++- .../src/generators/swift/migrations/1.0.0.ts | 26 ++++++++++++++++ .../src/generators/swift/migrations/index.ts | 20 +++++++++++++ packages/generator-migrations/src/index.ts | 4 +++ 9 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 generators/swift/sdk/changes/unreleased/fix-retry-status-codes.yml create mode 100644 packages/generator-migrations/src/generators/swift/migrations/1.0.0.ts create mode 100644 packages/generator-migrations/src/generators/swift/migrations/index.ts diff --git a/generators/swift/base/src/template/Sources/HTTPClient.Template.swift b/generators/swift/base/src/template/Sources/HTTPClient.Template.swift index be8b8939b58a..29d8abd5d4d3 100644 --- a/generators/swift/base/src/template/Sources/HTTPClient.Template.swift +++ b/generators/swift/base/src/template/Sources/HTTPClient.Template.swift @@ -331,7 +331,7 @@ final class HTTPClient: Swift.Sendable { } private func shouldRetry(statusCode: Swift.Int) -> Swift.Bool { - return statusCode == 408 || statusCode == 429 || statusCode >= 500 + return {{RETRY_STATUS_CHECK}} } private func getRetryDelay(response: Networking.HTTPURLResponse, retryAttempt: Swift.Int) diff --git a/generators/swift/codegen/src/custom-config/BaseSwiftCustomConfigSchema.ts b/generators/swift/codegen/src/custom-config/BaseSwiftCustomConfigSchema.ts index 7620058e5338..4dab696e83f3 100644 --- a/generators/swift/codegen/src/custom-config/BaseSwiftCustomConfigSchema.ts +++ b/generators/swift/codegen/src/custom-config/BaseSwiftCustomConfigSchema.ts @@ -8,7 +8,8 @@ export const BaseSwiftCustomConfigSchema = z.object({ customReadmeSections: z.array(CustomReadmeSectionSchema).optional(), enableWireTests: z.boolean().optional(), nullableAsOptional: z.boolean().optional(), - maxRetries: z.number().int().min(0).optional() + maxRetries: z.number().int().min(0).optional(), + retryStatusCodes: z.optional(z.enum(["legacy", "recommended"])) }); export type BaseSwiftCustomConfigSchema = z.infer; diff --git a/generators/swift/sdk/changes/unreleased/fix-retry-status-codes.yml b/generators/swift/sdk/changes/unreleased/fix-retry-status-codes.yml new file mode 100644 index 000000000000..20f0ad006fbe --- /dev/null +++ b/generators/swift/sdk/changes/unreleased/fix-retry-status-codes.yml @@ -0,0 +1,6 @@ +- summary: | + Add `retryStatusCodes` configuration option (`"legacy"` | `"recommended"`). + Legacy (default) preserves existing behavior (408, 429, >= 500). + Recommended retries only transient codes (408, 429, 502, 503, 504), excluding + 500 Internal Server Error to avoid retrying non-idempotent failures. + type: feat diff --git a/generators/swift/sdk/features.yml b/generators/swift/sdk/features.yml index 9ff1916dbbc2..1865cb81bd37 100644 --- a/generators/swift/sdk/features.yml +++ b/generators/swift/sdk/features.yml @@ -25,6 +25,26 @@ features: description: | If you would like to send additional query string parameters as part of the request, use the `additionalQueryParameters` request option. + - id: RETRIES + advanced: true + description: | + The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long + as the request is deemed retryable and the number of retry attempts has not grown larger than the configured + retry limit (default: 2). + + A request is deemed retryable when any of the following HTTP status codes is returned: + + - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) + - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) + - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + + The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + + - `legacy` (default): Retries `408`, `429`, and all `>= 500` + - `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) + + Use the `maxRetries` option to configure this behavior. + - id: TIMEOUTS advanced: true description: | diff --git a/generators/swift/sdk/src/SdkGeneratorCli.ts b/generators/swift/sdk/src/SdkGeneratorCli.ts index 36f4056d2851..ffc35dde27d7 100644 --- a/generators/swift/sdk/src/SdkGeneratorCli.ts +++ b/generators/swift/sdk/src/SdkGeneratorCli.ts @@ -189,12 +189,18 @@ export class SdkGeneratorCLI extends AbstractSwiftGeneratorCli= 500"; await Promise.all( entries(SourceTemplateFiles).map(async ([templateId, template]) => { const rawContents = await template.loadContents(); const templateData = templateDataGenerator.generateSourceTemplateData(templateId); if (templateData) { - const contents = this.renderTemplate(rawContents, templateData); + let contents = this.renderTemplate(rawContents, templateData); + contents = contents.replace(/\{\{RETRY_STATUS_CHECK\}\}/g, retryStatusCheck); + context.project.addSourceAsIsFile({ nameCandidateWithoutExtension: template.filenameWithoutExtension(templateData), directory: template.directory, diff --git a/packages/generator-migrations/src/__test__/index.test.ts b/packages/generator-migrations/src/__test__/index.test.ts index f1eeb29133f1..6f7b784ac767 100644 --- a/packages/generator-migrations/src/__test__/index.test.ts +++ b/packages/generator-migrations/src/__test__/index.test.ts @@ -233,9 +233,37 @@ describe("@fern-api/generator-migrations", () => { }); }); + describe("Swift SDK migrations", () => { + it("includes Swift SDK migration entries", () => { + expect(migrations["fernapi/fern-swift-sdk"]).toBeDefined(); + expect(migrations["fernapi/fern-swift-sdk"]?.migrations).toBeDefined(); + expect(Array.isArray(migrations["fernapi/fern-swift-sdk"]?.migrations)).toBe(true); + }); + + it("Swift SDK migrations have correct structure", () => { + const module = migrations["fernapi/fern-swift-sdk"]; + + expect(module).toBeDefined(); + expect(module?.migrations.length).toBeGreaterThan(0); + + for (const migration of module?.migrations ?? []) { + expect(migration).toHaveProperty("version"); + expect(migration).toHaveProperty("migrateGeneratorConfig"); + expect(migration).toHaveProperty("migrateGeneratorsYml"); + } + }); + + it("Swift SDK migrations are in semver order", () => { + const module = migrations["fernapi/fern-swift-sdk"]; + const versions = module?.migrations.map((m) => m.version) ?? []; + + expect(versions).toEqual(["1.0.0"]); + }); + }); + describe("generator name lookup", () => { it("returns undefined for generators without migrations", () => { - expect(migrations["fernapi/fern-swift-sdk"]).toBeUndefined(); + expect(migrations["fernapi/fern-openapi"]).toBeUndefined(); }); it("requires full generator name with fernapi prefix", () => { diff --git a/packages/generator-migrations/src/generators/swift/migrations/1.0.0.ts b/packages/generator-migrations/src/generators/swift/migrations/1.0.0.ts new file mode 100644 index 000000000000..311e0978e1a3 --- /dev/null +++ b/packages/generator-migrations/src/generators/swift/migrations/1.0.0.ts @@ -0,0 +1,26 @@ +import type { Migration } from "@fern-api/migrations-base"; +import { migrateConfig } from "@fern-api/migrations-base"; + +// Migration for version 1.0.0 +// +// Context: +// Version 1.0.0 changes the default retry behavior to only retry on transient +// HTTP status codes (408, 429, 502, 503, 504), instead of all >= 500. +// +// This migration explicitly pins the old default ("legacy") for users upgrading +// from pre-1.0.0 versions, so their retry behavior remains unchanged. +// +// Changed Defaults: +// - retryStatusCodes: "legacy" → "recommended" +// legacy: 408, 429, >= 500 +// recommended: 408, 429, 502, 503, 504 +export const migration_1_0_0: Migration = { + version: "1.0.0", + + migrateGeneratorConfig: ({ config }) => + migrateConfig(config, (draft) => { + draft.retryStatusCodes ??= "legacy"; + }), + + migrateGeneratorsYml: ({ document }) => document +}; diff --git a/packages/generator-migrations/src/generators/swift/migrations/index.ts b/packages/generator-migrations/src/generators/swift/migrations/index.ts new file mode 100644 index 000000000000..fc094dd97e25 --- /dev/null +++ b/packages/generator-migrations/src/generators/swift/migrations/index.ts @@ -0,0 +1,20 @@ +import type { MigrationModule } from "@fern-api/migrations-base"; + +import { migration_1_0_0 } from "./1.0.0.js"; + +/** + * Migration module for Swift SDK generator. + * + * This module contains migrations for configuration changes for + * the Swift SDK generator: + * - fernapi/fern-swift-sdk + * + * Each migration is defined in a separate file under this directory. + * Migrations are automatically applied by the Fern CLI when running: + * `fern generator upgrade --generator swift-sdk` + */ +const migrationModule: MigrationModule = { + migrations: [migration_1_0_0] +}; + +export default migrationModule; diff --git a/packages/generator-migrations/src/index.ts b/packages/generator-migrations/src/index.ts index a552a77766ac..0f81c3d042a8 100644 --- a/packages/generator-migrations/src/index.ts +++ b/packages/generator-migrations/src/index.ts @@ -14,6 +14,7 @@ import javaModelMigrations from "./generators/java-model/migrations/index.js"; import pythonSdkMigrations from "./generators/python/migrations/index.js"; import rubySdkMigrations from "./generators/ruby/migrations/index.js"; import rustSdkMigrations from "./generators/rust/migrations/index.js"; +import swiftSdkMigrations from "./generators/swift/migrations/index.js"; import typescriptSdkMigrations from "./generators/typescript/migrations/index.js"; /** @@ -50,6 +51,9 @@ export const migrations: Record = { // Rust SDK "fernapi/fern-rust-sdk": rustSdkMigrations, + // Swift SDK + "fernapi/fern-swift-sdk": swiftSdkMigrations, + // TypeScript SDK - all variants share the same migrations "fernapi/fern-typescript": typescriptSdkMigrations, "fernapi/fern-typescript-sdk": typescriptSdkMigrations, From 6a5c3e996eaf03282856ff69a02222f041f4a7e0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 15:21:57 +0000 Subject: [PATCH 11/43] chore(swift): release 0.34.0 --- .../{unreleased => 0.34.0}/fix-retry-status-codes.yml | 0 generators/swift/sdk/versions.yml | 10 ++++++++++ 2 files changed, 10 insertions(+) rename generators/swift/sdk/changes/{unreleased => 0.34.0}/fix-retry-status-codes.yml (100%) diff --git a/generators/swift/sdk/changes/unreleased/fix-retry-status-codes.yml b/generators/swift/sdk/changes/0.34.0/fix-retry-status-codes.yml similarity index 100% rename from generators/swift/sdk/changes/unreleased/fix-retry-status-codes.yml rename to generators/swift/sdk/changes/0.34.0/fix-retry-status-codes.yml diff --git a/generators/swift/sdk/versions.yml b/generators/swift/sdk/versions.yml index b2cfacaad730..5de370a42414 100644 --- a/generators/swift/sdk/versions.yml +++ b/generators/swift/sdk/versions.yml @@ -1,4 +1,14 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 0.34.0 + changelogEntry: + - summary: | + Add `retryStatusCodes` configuration option (`"legacy"` | `"recommended"`). + Legacy (default) preserves existing behavior (408, 429, >= 500). + Recommended retries only transient codes (408, 429, 502, 503, 504), excluding + 500 Internal Server Error to avoid retrying non-idempotent failures. + type: feat + createdAt: "2026-04-29" + irVersion: 66 - version: 0.33.1 changelogEntry: - summary: | From f703e268a740c8af084b522c66c53f92e80fab6c Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 11:27:35 -0400 Subject: [PATCH 12/43] chore(go): update go-sdk seed (#15565) Co-authored-by: dsinghvi <10870189+dsinghvi@users.noreply.github.com> --- seed/go-sdk/accept-header/README.md | 12 ++++++++++-- seed/go-sdk/alias/README.md | 12 ++++++++++-- seed/go-sdk/allof-inline/README.md | 12 ++++++++++-- seed/go-sdk/allof/README.md | 12 ++++++++++-- seed/go-sdk/any-auth/README.md | 12 ++++++++++-- seed/go-sdk/api-wide-base-path/README.md | 12 ++++++++++-- seed/go-sdk/audiences/README.md | 12 ++++++++++-- .../basic-auth-environment-variables/README.md | 12 ++++++++++-- .../basic-auth-pw-omitted/wire-tests/README.md | 12 ++++++++++-- seed/go-sdk/basic-auth/README.md | 12 ++++++++++-- .../bearer-token-environment-variable/README.md | 12 ++++++++++-- seed/go-sdk/bytes-upload/README.md | 12 ++++++++++-- seed/go-sdk/client-side-params/README.md | 12 ++++++++++-- seed/go-sdk/content-type/README.md | 12 ++++++++++-- seed/go-sdk/cross-package-type-names/README.md | 12 ++++++++++-- seed/go-sdk/endpoint-security-auth/README.md | 12 ++++++++++-- seed/go-sdk/enum/README.md | 12 ++++++++++-- seed/go-sdk/error-property/README.md | 12 ++++++++++-- seed/go-sdk/errors/README.md | 12 ++++++++++-- .../always-send-required-properties/README.md | 12 ++++++++++-- .../README.md | 12 ++++++++++-- seed/go-sdk/examples/client-name/README.md | 12 ++++++++++-- .../examples/export-all-requests-at-root/README.md | 12 ++++++++++-- seed/go-sdk/examples/exported-client-name/README.md | 12 ++++++++++-- seed/go-sdk/examples/getters-pass-by-value/README.md | 12 ++++++++++-- seed/go-sdk/examples/no-custom-config/README.md | 12 ++++++++++-- seed/go-sdk/examples/package-path/README.md | 12 ++++++++++-- seed/go-sdk/examples/readme-config/README.md | 12 ++++++++++-- seed/go-sdk/examples/v0/README.md | 12 ++++++++++-- seed/go-sdk/exhaustive/no-custom-config/README.md | 12 ++++++++++-- .../exhaustive/omit-empty-request-wrappers/README.md | 12 ++++++++++-- seed/go-sdk/extends/README.md | 12 ++++++++++-- seed/go-sdk/extra-properties/README.md | 12 ++++++++++-- seed/go-sdk/file-download/README.md | 12 ++++++++++-- seed/go-sdk/file-upload-openapi/README.md | 12 ++++++++++-- seed/go-sdk/file-upload/no-custom-config/README.md | 12 ++++++++++-- seed/go-sdk/file-upload/package-name/README.md | 12 ++++++++++-- seed/go-sdk/file-upload/v0/README.md | 12 ++++++++++-- seed/go-sdk/folders/README.md | 12 ++++++++++-- seed/go-sdk/go-content-type/README.md | 12 ++++++++++-- seed/go-sdk/go-deterministic-ordering/README.md | 12 ++++++++++-- seed/go-sdk/go-optional-literal-alias/README.md | 12 ++++++++++-- .../go-undiscriminated-union-wire-tests/README.md | 12 ++++++++++-- .../header-auth-environment-variable/README.md | 12 ++++++++++-- seed/go-sdk/header-auth/README.md | 12 ++++++++++-- seed/go-sdk/http-head/README.md | 12 ++++++++++-- seed/go-sdk/idempotency-headers/README.md | 12 ++++++++++-- seed/go-sdk/imdb/deep-package-path/README.md | 12 ++++++++++-- seed/go-sdk/imdb/no-custom-config/README.md | 12 ++++++++++-- seed/go-sdk/imdb/omit-fern-headers/README.md | 12 ++++++++++-- seed/go-sdk/imdb/package-path/README.md | 12 ++++++++++-- seed/go-sdk/imdb/with-wiremock-tests/README.md | 12 ++++++++++-- seed/go-sdk/inferred-auth-explicit/README.md | 12 ++++++++++-- seed/go-sdk/inferred-auth-implicit-api-key/README.md | 12 ++++++++++-- .../inferred-auth-implicit-no-expiry/README.md | 12 ++++++++++-- .../inferred-auth-implicit-reference/README.md | 12 ++++++++++-- seed/go-sdk/inferred-auth-implicit/README.md | 12 ++++++++++-- seed/go-sdk/license/README.md | 12 ++++++++++-- seed/go-sdk/literal/README.md | 12 ++++++++++-- seed/go-sdk/mixed-case/default-values/README.md | 12 ++++++++++-- seed/go-sdk/mixed-case/no-custom-config/README.md | 12 ++++++++++-- seed/go-sdk/mixed-file-directory/README.md | 12 ++++++++++-- seed/go-sdk/multi-line-docs/README.md | 12 ++++++++++-- .../multi-url-environment-no-default/README.md | 12 ++++++++++-- .../go-sdk/multi-url-environment-reference/README.md | 12 ++++++++++-- seed/go-sdk/multi-url-environment/README.md | 12 ++++++++++-- seed/go-sdk/multiple-request-bodies/README.md | 12 ++++++++++-- seed/go-sdk/no-content-response/README.md | 12 ++++++++++-- seed/go-sdk/no-environment/README.md | 12 ++++++++++-- seed/go-sdk/no-retries/README.md | 12 ++++++++++-- seed/go-sdk/null-type/README.md | 12 ++++++++++-- seed/go-sdk/nullable-allof-extends/README.md | 12 ++++++++++-- seed/go-sdk/nullable-optional/README.md | 12 ++++++++++-- .../dynamic-snippets-disabled/README.md | 12 ++++++++++-- seed/go-sdk/nullable/README.md | 12 ++++++++++-- .../go-sdk/oauth-client-credentials-custom/README.md | 12 ++++++++++-- .../oauth-client-credentials-default/README.md | 12 ++++++++++-- .../README.md | 12 ++++++++++-- .../no-custom-config/README.md | 12 ++++++++++-- .../oauth-client-credentials-nested-root/README.md | 12 ++++++++++-- .../oauth-client-credentials-openapi/README.md | 12 ++++++++++-- .../oauth-client-credentials-reference/README.md | 12 ++++++++++-- .../README.md | 12 ++++++++++-- seed/go-sdk/oauth-client-credentials/README.md | 12 ++++++++++-- .../no-custom-config/README.md | 12 ++++++++++-- seed/go-sdk/optional/README.md | 12 ++++++++++-- seed/go-sdk/package-yml/no-custom-config/README.md | 12 ++++++++++-- seed/go-sdk/pagination-custom/README.md | 12 ++++++++++-- .../path-parameters/no-custom-config/README.md | 12 ++++++++++-- seed/go-sdk/path-parameters/package-name/README.md | 12 ++++++++++-- seed/go-sdk/path-parameters/v0/README.md | 12 ++++++++++-- seed/go-sdk/plain-text/README.md | 12 ++++++++++-- seed/go-sdk/property-access/README.md | 12 ++++++++++-- seed/go-sdk/query-param-name-conflict/README.md | 12 ++++++++++-- .../query-parameters-openapi-as-objects/README.md | 12 ++++++++++-- seed/go-sdk/query-parameters-openapi/README.md | 12 ++++++++++-- seed/go-sdk/query-parameters/README.md | 12 ++++++++++-- seed/go-sdk/required-nullable/README.md | 12 ++++++++++-- seed/go-sdk/reserved-keywords/README.md | 12 ++++++++++-- seed/go-sdk/response-property/README.md | 12 ++++++++++-- .../schemaless-request-body-examples/README.md | 12 ++++++++++-- .../with-wire-tests/README.md | 12 ++++++++++-- .../with-wire-tests/README.md | 12 ++++++++++-- .../server-sent-events/with-wire-tests/README.md | 12 ++++++++++-- seed/go-sdk/server-url-templating/README.md | 12 ++++++++++-- seed/go-sdk/simple-api/README.md | 12 ++++++++++-- seed/go-sdk/simple-fhir/README.md | 12 ++++++++++-- seed/go-sdk/single-url-environment-default/README.md | 12 ++++++++++-- .../single-url-environment-no-default/README.md | 12 ++++++++++-- seed/go-sdk/streaming/README.md | 12 ++++++++++-- .../README.md | 12 ++++++++++-- .../no-custom-config/README.md | 12 ++++++++++-- seed/go-sdk/undiscriminated-unions/v0/README.md | 12 ++++++++++-- seed/go-sdk/union-query-parameters/README.md | 12 ++++++++++-- seed/go-sdk/unions-with-local-date/README.md | 12 ++++++++++-- seed/go-sdk/unions/no-custom-config/README.md | 12 ++++++++++-- seed/go-sdk/unions/package-name/README.md | 12 ++++++++++-- seed/go-sdk/unions/v0/README.md | 12 ++++++++++-- seed/go-sdk/unknown/README.md | 12 ++++++++++-- seed/go-sdk/url-form-encoded/README.md | 12 ++++++++++-- seed/go-sdk/validation/README.md | 12 ++++++++++-- seed/go-sdk/variables/README.md | 12 ++++++++++-- seed/go-sdk/version-no-default/README.md | 12 ++++++++++-- seed/go-sdk/version/README.md | 12 ++++++++++-- seed/go-sdk/websocket-inferred-auth/README.md | 12 ++++++++++-- seed/go-sdk/x-fern-default/README.md | 12 ++++++++++-- 126 files changed, 1260 insertions(+), 252 deletions(-) diff --git a/seed/go-sdk/accept-header/README.md b/seed/go-sdk/accept-header/README.md index 80d55e2ff0b3..e0ad93ea14df 100644 --- a/seed/go-sdk/accept-header/README.md +++ b/seed/go-sdk/accept-header/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/alias/README.md b/seed/go-sdk/alias/README.md index 7a4c7735d04a..61507e6ea97e 100644 --- a/seed/go-sdk/alias/README.md +++ b/seed/go-sdk/alias/README.md @@ -124,11 +124,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/allof-inline/README.md b/seed/go-sdk/allof-inline/README.md index b38d709447cd..97c3dedc64e3 100644 --- a/seed/go-sdk/allof-inline/README.md +++ b/seed/go-sdk/allof-inline/README.md @@ -129,11 +129,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/allof/README.md b/seed/go-sdk/allof/README.md index ee34317a346e..3b359ee19186 100644 --- a/seed/go-sdk/allof/README.md +++ b/seed/go-sdk/allof/README.md @@ -129,11 +129,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/any-auth/README.md b/seed/go-sdk/any-auth/README.md index c8405dbd0dee..a3a2ac55e9bf 100644 --- a/seed/go-sdk/any-auth/README.md +++ b/seed/go-sdk/any-auth/README.md @@ -160,11 +160,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/api-wide-base-path/README.md b/seed/go-sdk/api-wide-base-path/README.md index 9c1f1afe4bcf..61f6b1aa0f7a 100644 --- a/seed/go-sdk/api-wide-base-path/README.md +++ b/seed/go-sdk/api-wide-base-path/README.md @@ -127,11 +127,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/audiences/README.md b/seed/go-sdk/audiences/README.md index 830ce6c690ab..8dff682ef44e 100644 --- a/seed/go-sdk/audiences/README.md +++ b/seed/go-sdk/audiences/README.md @@ -136,11 +136,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/basic-auth-environment-variables/README.md b/seed/go-sdk/basic-auth-environment-variables/README.md index 8dc006fa1ed7..de65b942a539 100644 --- a/seed/go-sdk/basic-auth-environment-variables/README.md +++ b/seed/go-sdk/basic-auth-environment-variables/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/basic-auth-pw-omitted/wire-tests/README.md b/seed/go-sdk/basic-auth-pw-omitted/wire-tests/README.md index d5ad34c1dad4..af5078f9ee46 100644 --- a/seed/go-sdk/basic-auth-pw-omitted/wire-tests/README.md +++ b/seed/go-sdk/basic-auth-pw-omitted/wire-tests/README.md @@ -132,11 +132,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/basic-auth/README.md b/seed/go-sdk/basic-auth/README.md index b1da2d195bb7..d494f9168313 100644 --- a/seed/go-sdk/basic-auth/README.md +++ b/seed/go-sdk/basic-auth/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/bearer-token-environment-variable/README.md b/seed/go-sdk/bearer-token-environment-variable/README.md index 9bd7d5fbd91b..d721df558162 100644 --- a/seed/go-sdk/bearer-token-environment-variable/README.md +++ b/seed/go-sdk/bearer-token-environment-variable/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/bytes-upload/README.md b/seed/go-sdk/bytes-upload/README.md index 9443eb79f1e6..211fdde36a28 100644 --- a/seed/go-sdk/bytes-upload/README.md +++ b/seed/go-sdk/bytes-upload/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/client-side-params/README.md b/seed/go-sdk/client-side-params/README.md index 2d1d690b5f7c..b35b33c7539b 100644 --- a/seed/go-sdk/client-side-params/README.md +++ b/seed/go-sdk/client-side-params/README.md @@ -142,11 +142,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/content-type/README.md b/seed/go-sdk/content-type/README.md index 16fca29765c7..34ac385ae6cc 100644 --- a/seed/go-sdk/content-type/README.md +++ b/seed/go-sdk/content-type/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/cross-package-type-names/README.md b/seed/go-sdk/cross-package-type-names/README.md index 1edd7d7c68d3..5a110e963fdf 100644 --- a/seed/go-sdk/cross-package-type-names/README.md +++ b/seed/go-sdk/cross-package-type-names/README.md @@ -136,11 +136,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/endpoint-security-auth/README.md b/seed/go-sdk/endpoint-security-auth/README.md index 6c1149ca9226..708eede2851c 100644 --- a/seed/go-sdk/endpoint-security-auth/README.md +++ b/seed/go-sdk/endpoint-security-auth/README.md @@ -160,11 +160,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/enum/README.md b/seed/go-sdk/enum/README.md index d91615983ace..a418b09f4256 100644 --- a/seed/go-sdk/enum/README.md +++ b/seed/go-sdk/enum/README.md @@ -132,11 +132,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/error-property/README.md b/seed/go-sdk/error-property/README.md index 3eb52396132e..d38de6f9c0fb 100644 --- a/seed/go-sdk/error-property/README.md +++ b/seed/go-sdk/error-property/README.md @@ -123,11 +123,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/errors/README.md b/seed/go-sdk/errors/README.md index 039c517db497..14a8df7b30d9 100644 --- a/seed/go-sdk/errors/README.md +++ b/seed/go-sdk/errors/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/examples/always-send-required-properties/README.md b/seed/go-sdk/examples/always-send-required-properties/README.md index ced998124d38..e45f92884eb5 100644 --- a/seed/go-sdk/examples/always-send-required-properties/README.md +++ b/seed/go-sdk/examples/always-send-required-properties/README.md @@ -130,11 +130,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/examples/client-name-with-custom-constructor-name/README.md b/seed/go-sdk/examples/client-name-with-custom-constructor-name/README.md index d31b52549cf6..fd276a1e00ee 100644 --- a/seed/go-sdk/examples/client-name-with-custom-constructor-name/README.md +++ b/seed/go-sdk/examples/client-name-with-custom-constructor-name/README.md @@ -130,11 +130,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/examples/client-name/README.md b/seed/go-sdk/examples/client-name/README.md index 5d6e19d18e3f..0f7db8e06213 100644 --- a/seed/go-sdk/examples/client-name/README.md +++ b/seed/go-sdk/examples/client-name/README.md @@ -130,11 +130,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/examples/export-all-requests-at-root/README.md b/seed/go-sdk/examples/export-all-requests-at-root/README.md index ced998124d38..e45f92884eb5 100644 --- a/seed/go-sdk/examples/export-all-requests-at-root/README.md +++ b/seed/go-sdk/examples/export-all-requests-at-root/README.md @@ -130,11 +130,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/examples/exported-client-name/README.md b/seed/go-sdk/examples/exported-client-name/README.md index 64b985cb30ea..5762a7df3993 100644 --- a/seed/go-sdk/examples/exported-client-name/README.md +++ b/seed/go-sdk/examples/exported-client-name/README.md @@ -130,11 +130,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/examples/getters-pass-by-value/README.md b/seed/go-sdk/examples/getters-pass-by-value/README.md index ced998124d38..e45f92884eb5 100644 --- a/seed/go-sdk/examples/getters-pass-by-value/README.md +++ b/seed/go-sdk/examples/getters-pass-by-value/README.md @@ -130,11 +130,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/examples/no-custom-config/README.md b/seed/go-sdk/examples/no-custom-config/README.md index ced998124d38..e45f92884eb5 100644 --- a/seed/go-sdk/examples/no-custom-config/README.md +++ b/seed/go-sdk/examples/no-custom-config/README.md @@ -130,11 +130,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/examples/package-path/README.md b/seed/go-sdk/examples/package-path/README.md index aab224771996..d4fc08d4d867 100644 --- a/seed/go-sdk/examples/package-path/README.md +++ b/seed/go-sdk/examples/package-path/README.md @@ -130,11 +130,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/examples/readme-config/README.md b/seed/go-sdk/examples/readme-config/README.md index a18c2b5848ff..d52e62790fa5 100644 --- a/seed/go-sdk/examples/readme-config/README.md +++ b/seed/go-sdk/examples/readme-config/README.md @@ -372,11 +372,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/examples/v0/README.md b/seed/go-sdk/examples/v0/README.md index ced998124d38..e45f92884eb5 100644 --- a/seed/go-sdk/examples/v0/README.md +++ b/seed/go-sdk/examples/v0/README.md @@ -130,11 +130,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/exhaustive/no-custom-config/README.md b/seed/go-sdk/exhaustive/no-custom-config/README.md index 82781203ee3d..202989b61c80 100644 --- a/seed/go-sdk/exhaustive/no-custom-config/README.md +++ b/seed/go-sdk/exhaustive/no-custom-config/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/exhaustive/omit-empty-request-wrappers/README.md b/seed/go-sdk/exhaustive/omit-empty-request-wrappers/README.md index 82781203ee3d..202989b61c80 100644 --- a/seed/go-sdk/exhaustive/omit-empty-request-wrappers/README.md +++ b/seed/go-sdk/exhaustive/omit-empty-request-wrappers/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/extends/README.md b/seed/go-sdk/extends/README.md index 1ffabee8c4c5..6046324c2483 100644 --- a/seed/go-sdk/extends/README.md +++ b/seed/go-sdk/extends/README.md @@ -130,11 +130,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/extra-properties/README.md b/seed/go-sdk/extra-properties/README.md index 18239dea2cea..5a823593befe 100644 --- a/seed/go-sdk/extra-properties/README.md +++ b/seed/go-sdk/extra-properties/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/file-download/README.md b/seed/go-sdk/file-download/README.md index f7df8ef1a495..85f6e0f38b24 100644 --- a/seed/go-sdk/file-download/README.md +++ b/seed/go-sdk/file-download/README.md @@ -123,11 +123,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/file-upload-openapi/README.md b/seed/go-sdk/file-upload-openapi/README.md index 56341ff839d6..572fda5c8e04 100644 --- a/seed/go-sdk/file-upload-openapi/README.md +++ b/seed/go-sdk/file-upload-openapi/README.md @@ -132,11 +132,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/file-upload/no-custom-config/README.md b/seed/go-sdk/file-upload/no-custom-config/README.md index 71dde44cb316..0ab907239b52 100644 --- a/seed/go-sdk/file-upload/no-custom-config/README.md +++ b/seed/go-sdk/file-upload/no-custom-config/README.md @@ -131,11 +131,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/file-upload/package-name/README.md b/seed/go-sdk/file-upload/package-name/README.md index d504fcf3f600..096183586448 100644 --- a/seed/go-sdk/file-upload/package-name/README.md +++ b/seed/go-sdk/file-upload/package-name/README.md @@ -131,11 +131,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/file-upload/v0/README.md b/seed/go-sdk/file-upload/v0/README.md index 11e36670c3ac..b1392a4ec928 100644 --- a/seed/go-sdk/file-upload/v0/README.md +++ b/seed/go-sdk/file-upload/v0/README.md @@ -127,11 +127,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/folders/README.md b/seed/go-sdk/folders/README.md index a57d5d181ac7..83a47c8154ef 100644 --- a/seed/go-sdk/folders/README.md +++ b/seed/go-sdk/folders/README.md @@ -123,11 +123,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/go-content-type/README.md b/seed/go-sdk/go-content-type/README.md index 7dac2cbc9f92..de8bf4d4fa04 100644 --- a/seed/go-sdk/go-content-type/README.md +++ b/seed/go-sdk/go-content-type/README.md @@ -134,11 +134,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/go-deterministic-ordering/README.md b/seed/go-sdk/go-deterministic-ordering/README.md index 39453a620c82..f2a02cd869fc 100644 --- a/seed/go-sdk/go-deterministic-ordering/README.md +++ b/seed/go-sdk/go-deterministic-ordering/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/go-optional-literal-alias/README.md b/seed/go-sdk/go-optional-literal-alias/README.md index cc6759aaec4e..5c5332c8127e 100644 --- a/seed/go-sdk/go-optional-literal-alias/README.md +++ b/seed/go-sdk/go-optional-literal-alias/README.md @@ -131,11 +131,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/go-undiscriminated-union-wire-tests/README.md b/seed/go-sdk/go-undiscriminated-union-wire-tests/README.md index b10d5c27089f..8083c01b624d 100644 --- a/seed/go-sdk/go-undiscriminated-union-wire-tests/README.md +++ b/seed/go-sdk/go-undiscriminated-union-wire-tests/README.md @@ -145,11 +145,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/header-auth-environment-variable/README.md b/seed/go-sdk/header-auth-environment-variable/README.md index ca429eb3be02..92bffa9e311b 100644 --- a/seed/go-sdk/header-auth-environment-variable/README.md +++ b/seed/go-sdk/header-auth-environment-variable/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/header-auth/README.md b/seed/go-sdk/header-auth/README.md index 2410684ad5db..d5c4fef18240 100644 --- a/seed/go-sdk/header-auth/README.md +++ b/seed/go-sdk/header-auth/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/http-head/README.md b/seed/go-sdk/http-head/README.md index f81f91bdd0a0..6142ed7ff950 100644 --- a/seed/go-sdk/http-head/README.md +++ b/seed/go-sdk/http-head/README.md @@ -123,11 +123,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/idempotency-headers/README.md b/seed/go-sdk/idempotency-headers/README.md index 0dc244c5705a..0a7dbe5ee555 100644 --- a/seed/go-sdk/idempotency-headers/README.md +++ b/seed/go-sdk/idempotency-headers/README.md @@ -134,11 +134,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/imdb/deep-package-path/README.md b/seed/go-sdk/imdb/deep-package-path/README.md index c7cb779ea266..b8e9f51ff249 100644 --- a/seed/go-sdk/imdb/deep-package-path/README.md +++ b/seed/go-sdk/imdb/deep-package-path/README.md @@ -134,11 +134,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/imdb/no-custom-config/README.md b/seed/go-sdk/imdb/no-custom-config/README.md index f5a7f0f9405d..66b3bed8a752 100644 --- a/seed/go-sdk/imdb/no-custom-config/README.md +++ b/seed/go-sdk/imdb/no-custom-config/README.md @@ -134,11 +134,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/imdb/omit-fern-headers/README.md b/seed/go-sdk/imdb/omit-fern-headers/README.md index f5a7f0f9405d..66b3bed8a752 100644 --- a/seed/go-sdk/imdb/omit-fern-headers/README.md +++ b/seed/go-sdk/imdb/omit-fern-headers/README.md @@ -134,11 +134,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/imdb/package-path/README.md b/seed/go-sdk/imdb/package-path/README.md index db9d01ec2140..9370df2105da 100644 --- a/seed/go-sdk/imdb/package-path/README.md +++ b/seed/go-sdk/imdb/package-path/README.md @@ -134,11 +134,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/imdb/with-wiremock-tests/README.md b/seed/go-sdk/imdb/with-wiremock-tests/README.md index a8fdd4107bfd..1d9cd344cd8a 100644 --- a/seed/go-sdk/imdb/with-wiremock-tests/README.md +++ b/seed/go-sdk/imdb/with-wiremock-tests/README.md @@ -134,11 +134,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/inferred-auth-explicit/README.md b/seed/go-sdk/inferred-auth-explicit/README.md index 6536bfe549eb..33ea0288a63c 100644 --- a/seed/go-sdk/inferred-auth-explicit/README.md +++ b/seed/go-sdk/inferred-auth-explicit/README.md @@ -144,11 +144,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/inferred-auth-implicit-api-key/README.md b/seed/go-sdk/inferred-auth-implicit-api-key/README.md index 3a313aca4112..7100a0cdcff6 100644 --- a/seed/go-sdk/inferred-auth-implicit-api-key/README.md +++ b/seed/go-sdk/inferred-auth-implicit-api-key/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/inferred-auth-implicit-no-expiry/README.md b/seed/go-sdk/inferred-auth-implicit-no-expiry/README.md index 6a45f37947f3..846c523bee52 100644 --- a/seed/go-sdk/inferred-auth-implicit-no-expiry/README.md +++ b/seed/go-sdk/inferred-auth-implicit-no-expiry/README.md @@ -144,11 +144,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/inferred-auth-implicit-reference/README.md b/seed/go-sdk/inferred-auth-implicit-reference/README.md index 20c164389713..0a2af925c0dc 100644 --- a/seed/go-sdk/inferred-auth-implicit-reference/README.md +++ b/seed/go-sdk/inferred-auth-implicit-reference/README.md @@ -140,11 +140,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/inferred-auth-implicit/README.md b/seed/go-sdk/inferred-auth-implicit/README.md index a6ca0ab75436..5b08e5b5e96f 100644 --- a/seed/go-sdk/inferred-auth-implicit/README.md +++ b/seed/go-sdk/inferred-auth-implicit/README.md @@ -144,11 +144,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/license/README.md b/seed/go-sdk/license/README.md index 7c4d43c284d7..896f4a524836 100644 --- a/seed/go-sdk/license/README.md +++ b/seed/go-sdk/license/README.md @@ -123,11 +123,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/literal/README.md b/seed/go-sdk/literal/README.md index de3380daef50..2d55af765105 100644 --- a/seed/go-sdk/literal/README.md +++ b/seed/go-sdk/literal/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/mixed-case/default-values/README.md b/seed/go-sdk/mixed-case/default-values/README.md index fa2048eaea1d..964a8aebe681 100644 --- a/seed/go-sdk/mixed-case/default-values/README.md +++ b/seed/go-sdk/mixed-case/default-values/README.md @@ -124,11 +124,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/mixed-case/no-custom-config/README.md b/seed/go-sdk/mixed-case/no-custom-config/README.md index fa2048eaea1d..964a8aebe681 100644 --- a/seed/go-sdk/mixed-case/no-custom-config/README.md +++ b/seed/go-sdk/mixed-case/no-custom-config/README.md @@ -124,11 +124,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/mixed-file-directory/README.md b/seed/go-sdk/mixed-file-directory/README.md index baa338bd470b..3d347f0abc6e 100644 --- a/seed/go-sdk/mixed-file-directory/README.md +++ b/seed/go-sdk/mixed-file-directory/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/multi-line-docs/README.md b/seed/go-sdk/multi-line-docs/README.md index 2035d2636761..98a261b671e4 100644 --- a/seed/go-sdk/multi-line-docs/README.md +++ b/seed/go-sdk/multi-line-docs/README.md @@ -131,11 +131,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/multi-url-environment-no-default/README.md b/seed/go-sdk/multi-url-environment-no-default/README.md index 56002fa133a8..9bc8f59c8484 100644 --- a/seed/go-sdk/multi-url-environment-no-default/README.md +++ b/seed/go-sdk/multi-url-environment-no-default/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/multi-url-environment-reference/README.md b/seed/go-sdk/multi-url-environment-reference/README.md index d06281ee8110..56dacb0dc05a 100644 --- a/seed/go-sdk/multi-url-environment-reference/README.md +++ b/seed/go-sdk/multi-url-environment-reference/README.md @@ -134,11 +134,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/multi-url-environment/README.md b/seed/go-sdk/multi-url-environment/README.md index cebb3ac9d109..457782cef6c6 100644 --- a/seed/go-sdk/multi-url-environment/README.md +++ b/seed/go-sdk/multi-url-environment/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/multiple-request-bodies/README.md b/seed/go-sdk/multiple-request-bodies/README.md index 7c137950fb38..466a4f4bf38d 100644 --- a/seed/go-sdk/multiple-request-bodies/README.md +++ b/seed/go-sdk/multiple-request-bodies/README.md @@ -131,11 +131,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/no-content-response/README.md b/seed/go-sdk/no-content-response/README.md index 00dd78f8abe9..a7536430bebf 100644 --- a/seed/go-sdk/no-content-response/README.md +++ b/seed/go-sdk/no-content-response/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/no-environment/README.md b/seed/go-sdk/no-environment/README.md index 4d98b2419208..60c4bd0d95cb 100644 --- a/seed/go-sdk/no-environment/README.md +++ b/seed/go-sdk/no-environment/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/no-retries/README.md b/seed/go-sdk/no-retries/README.md index dd930b78256d..0755842d5196 100644 --- a/seed/go-sdk/no-retries/README.md +++ b/seed/go-sdk/no-retries/README.md @@ -123,11 +123,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/null-type/README.md b/seed/go-sdk/null-type/README.md index e28d312291bf..5ca1aa973ac8 100644 --- a/seed/go-sdk/null-type/README.md +++ b/seed/go-sdk/null-type/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/nullable-allof-extends/README.md b/seed/go-sdk/nullable-allof-extends/README.md index 08b998cd3dcc..780bdecf0161 100644 --- a/seed/go-sdk/nullable-allof-extends/README.md +++ b/seed/go-sdk/nullable-allof-extends/README.md @@ -126,11 +126,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/nullable-optional/README.md b/seed/go-sdk/nullable-optional/README.md index 541a2720261e..603ef9d3574a 100644 --- a/seed/go-sdk/nullable-optional/README.md +++ b/seed/go-sdk/nullable-optional/README.md @@ -153,11 +153,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/nullable-request-body/dynamic-snippets-disabled/README.md b/seed/go-sdk/nullable-request-body/dynamic-snippets-disabled/README.md index 994b1999f9aa..32f56dbcd586 100644 --- a/seed/go-sdk/nullable-request-body/dynamic-snippets-disabled/README.md +++ b/seed/go-sdk/nullable-request-body/dynamic-snippets-disabled/README.md @@ -129,11 +129,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/nullable/README.md b/seed/go-sdk/nullable/README.md index 307457464acd..0ff14bf57711 100644 --- a/seed/go-sdk/nullable/README.md +++ b/seed/go-sdk/nullable/README.md @@ -157,11 +157,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/oauth-client-credentials-custom/README.md b/seed/go-sdk/oauth-client-credentials-custom/README.md index fd639827c77c..8d84adacfcf5 100644 --- a/seed/go-sdk/oauth-client-credentials-custom/README.md +++ b/seed/go-sdk/oauth-client-credentials-custom/README.md @@ -166,11 +166,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/oauth-client-credentials-default/README.md b/seed/go-sdk/oauth-client-credentials-default/README.md index 6a7e0e670aaf..a45d47d42540 100644 --- a/seed/go-sdk/oauth-client-credentials-default/README.md +++ b/seed/go-sdk/oauth-client-credentials-default/README.md @@ -161,11 +161,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/oauth-client-credentials-environment-variables/README.md b/seed/go-sdk/oauth-client-credentials-environment-variables/README.md index f4e3420a2aea..2f2baaaceafb 100644 --- a/seed/go-sdk/oauth-client-credentials-environment-variables/README.md +++ b/seed/go-sdk/oauth-client-credentials-environment-variables/README.md @@ -164,11 +164,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/oauth-client-credentials-mandatory-auth/no-custom-config/README.md b/seed/go-sdk/oauth-client-credentials-mandatory-auth/no-custom-config/README.md index 6f1b0216f337..472a566c0230 100644 --- a/seed/go-sdk/oauth-client-credentials-mandatory-auth/no-custom-config/README.md +++ b/seed/go-sdk/oauth-client-credentials-mandatory-auth/no-custom-config/README.md @@ -164,11 +164,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/oauth-client-credentials-nested-root/README.md b/seed/go-sdk/oauth-client-credentials-nested-root/README.md index 401405df499d..37609b353c17 100644 --- a/seed/go-sdk/oauth-client-credentials-nested-root/README.md +++ b/seed/go-sdk/oauth-client-credentials-nested-root/README.md @@ -165,11 +165,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/oauth-client-credentials-openapi/README.md b/seed/go-sdk/oauth-client-credentials-openapi/README.md index 9e4c97c8269f..57c373ceb46b 100644 --- a/seed/go-sdk/oauth-client-credentials-openapi/README.md +++ b/seed/go-sdk/oauth-client-credentials-openapi/README.md @@ -161,11 +161,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/oauth-client-credentials-reference/README.md b/seed/go-sdk/oauth-client-credentials-reference/README.md index e3e6a03de434..ad48ce4b6dcb 100644 --- a/seed/go-sdk/oauth-client-credentials-reference/README.md +++ b/seed/go-sdk/oauth-client-credentials-reference/README.md @@ -161,11 +161,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/oauth-client-credentials-with-variables/README.md b/seed/go-sdk/oauth-client-credentials-with-variables/README.md index 0641345207ce..6af70e58280e 100644 --- a/seed/go-sdk/oauth-client-credentials-with-variables/README.md +++ b/seed/go-sdk/oauth-client-credentials-with-variables/README.md @@ -164,11 +164,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/oauth-client-credentials/README.md b/seed/go-sdk/oauth-client-credentials/README.md index 9b69d0aa90df..b783e72c6098 100644 --- a/seed/go-sdk/oauth-client-credentials/README.md +++ b/seed/go-sdk/oauth-client-credentials/README.md @@ -164,11 +164,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/openapi-request-body-ref/no-custom-config/README.md b/seed/go-sdk/openapi-request-body-ref/no-custom-config/README.md index c22c61bd9287..ec7d72e506f8 100644 --- a/seed/go-sdk/openapi-request-body-ref/no-custom-config/README.md +++ b/seed/go-sdk/openapi-request-body-ref/no-custom-config/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/optional/README.md b/seed/go-sdk/optional/README.md index 6ee97220176e..cfbdc983c2da 100644 --- a/seed/go-sdk/optional/README.md +++ b/seed/go-sdk/optional/README.md @@ -129,11 +129,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/package-yml/no-custom-config/README.md b/seed/go-sdk/package-yml/no-custom-config/README.md index 4a018861395f..e11109d04e64 100644 --- a/seed/go-sdk/package-yml/no-custom-config/README.md +++ b/seed/go-sdk/package-yml/no-custom-config/README.md @@ -130,11 +130,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/pagination-custom/README.md b/seed/go-sdk/pagination-custom/README.md index f30439fcc06d..f9edaf42941a 100644 --- a/seed/go-sdk/pagination-custom/README.md +++ b/seed/go-sdk/pagination-custom/README.md @@ -216,11 +216,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/path-parameters/no-custom-config/README.md b/seed/go-sdk/path-parameters/no-custom-config/README.md index 714d005b71f2..097efe667ca3 100644 --- a/seed/go-sdk/path-parameters/no-custom-config/README.md +++ b/seed/go-sdk/path-parameters/no-custom-config/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/path-parameters/package-name/README.md b/seed/go-sdk/path-parameters/package-name/README.md index 0d04b18ef834..c5ada4124ec6 100644 --- a/seed/go-sdk/path-parameters/package-name/README.md +++ b/seed/go-sdk/path-parameters/package-name/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/path-parameters/v0/README.md b/seed/go-sdk/path-parameters/v0/README.md index 714d005b71f2..097efe667ca3 100644 --- a/seed/go-sdk/path-parameters/v0/README.md +++ b/seed/go-sdk/path-parameters/v0/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/plain-text/README.md b/seed/go-sdk/plain-text/README.md index e103d84e3886..521bb7de1183 100644 --- a/seed/go-sdk/plain-text/README.md +++ b/seed/go-sdk/plain-text/README.md @@ -123,11 +123,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/property-access/README.md b/seed/go-sdk/property-access/README.md index e3183cbe810e..3a216154bf12 100644 --- a/seed/go-sdk/property-access/README.md +++ b/seed/go-sdk/property-access/README.md @@ -137,11 +137,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/query-param-name-conflict/README.md b/seed/go-sdk/query-param-name-conflict/README.md index 65c83fc90dda..fab4a43cc949 100644 --- a/seed/go-sdk/query-param-name-conflict/README.md +++ b/seed/go-sdk/query-param-name-conflict/README.md @@ -126,11 +126,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/query-parameters-openapi-as-objects/README.md b/seed/go-sdk/query-parameters-openapi-as-objects/README.md index 428de1f9cdc7..b544ce0bb68f 100644 --- a/seed/go-sdk/query-parameters-openapi-as-objects/README.md +++ b/seed/go-sdk/query-parameters-openapi-as-objects/README.md @@ -238,11 +238,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/query-parameters-openapi/README.md b/seed/go-sdk/query-parameters-openapi/README.md index d9594c6ecde4..204cfea18630 100644 --- a/seed/go-sdk/query-parameters-openapi/README.md +++ b/seed/go-sdk/query-parameters-openapi/README.md @@ -238,11 +238,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/query-parameters/README.md b/seed/go-sdk/query-parameters/README.md index 08d733b34860..a85fc18fb7ad 100644 --- a/seed/go-sdk/query-parameters/README.md +++ b/seed/go-sdk/query-parameters/README.md @@ -202,11 +202,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/required-nullable/README.md b/seed/go-sdk/required-nullable/README.md index 113cc5cd61be..cc8ae075ae3e 100644 --- a/seed/go-sdk/required-nullable/README.md +++ b/seed/go-sdk/required-nullable/README.md @@ -131,11 +131,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/reserved-keywords/README.md b/seed/go-sdk/reserved-keywords/README.md index ab21dd30dfe6..75d42336433f 100644 --- a/seed/go-sdk/reserved-keywords/README.md +++ b/seed/go-sdk/reserved-keywords/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/response-property/README.md b/seed/go-sdk/response-property/README.md index fe132b1af73e..ff2240c7804d 100644 --- a/seed/go-sdk/response-property/README.md +++ b/seed/go-sdk/response-property/README.md @@ -125,11 +125,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/schemaless-request-body-examples/README.md b/seed/go-sdk/schemaless-request-body-examples/README.md index bd96e1877aef..3c933e70a432 100644 --- a/seed/go-sdk/schemaless-request-body-examples/README.md +++ b/seed/go-sdk/schemaless-request-body-examples/README.md @@ -137,11 +137,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/README.md b/seed/go-sdk/server-sent-event-examples/with-wire-tests/README.md index 852b970fdcf9..7904c7661ccf 100644 --- a/seed/go-sdk/server-sent-event-examples/with-wire-tests/README.md +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/server-sent-events-openapi/with-wire-tests/README.md b/seed/go-sdk/server-sent-events-openapi/with-wire-tests/README.md index e10cfc1f5788..07dae8470551 100644 --- a/seed/go-sdk/server-sent-events-openapi/with-wire-tests/README.md +++ b/seed/go-sdk/server-sent-events-openapi/with-wire-tests/README.md @@ -126,11 +126,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/server-sent-events/with-wire-tests/README.md b/seed/go-sdk/server-sent-events/with-wire-tests/README.md index 6737887e6077..fc1687dd577f 100644 --- a/seed/go-sdk/server-sent-events/with-wire-tests/README.md +++ b/seed/go-sdk/server-sent-events/with-wire-tests/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/server-url-templating/README.md b/seed/go-sdk/server-url-templating/README.md index 042c9bb8c6cd..f668172a8897 100644 --- a/seed/go-sdk/server-url-templating/README.md +++ b/seed/go-sdk/server-url-templating/README.md @@ -129,11 +129,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/simple-api/README.md b/seed/go-sdk/simple-api/README.md index 8f7fac67f8a5..a78e1d57807d 100644 --- a/seed/go-sdk/simple-api/README.md +++ b/seed/go-sdk/simple-api/README.md @@ -129,11 +129,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/simple-fhir/README.md b/seed/go-sdk/simple-fhir/README.md index 607d9e30eb25..bc9c2ff165fc 100644 --- a/seed/go-sdk/simple-fhir/README.md +++ b/seed/go-sdk/simple-fhir/README.md @@ -124,11 +124,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/single-url-environment-default/README.md b/seed/go-sdk/single-url-environment-default/README.md index 59a3bf0f5508..63ce5cef5a9a 100644 --- a/seed/go-sdk/single-url-environment-default/README.md +++ b/seed/go-sdk/single-url-environment-default/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/single-url-environment-no-default/README.md b/seed/go-sdk/single-url-environment-no-default/README.md index f6651fc07618..d0ced3004b1e 100644 --- a/seed/go-sdk/single-url-environment-no-default/README.md +++ b/seed/go-sdk/single-url-environment-no-default/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/streaming/README.md b/seed/go-sdk/streaming/README.md index d9230e9549e7..fae084c2efe7 100644 --- a/seed/go-sdk/streaming/README.md +++ b/seed/go-sdk/streaming/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/undiscriminated-union-with-response-property/README.md b/seed/go-sdk/undiscriminated-union-with-response-property/README.md index 0d43802497ba..986c14bcd909 100644 --- a/seed/go-sdk/undiscriminated-union-with-response-property/README.md +++ b/seed/go-sdk/undiscriminated-union-with-response-property/README.md @@ -123,11 +123,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/undiscriminated-unions/no-custom-config/README.md b/seed/go-sdk/undiscriminated-unions/no-custom-config/README.md index a4bf6c454754..a96744f49c07 100644 --- a/seed/go-sdk/undiscriminated-unions/no-custom-config/README.md +++ b/seed/go-sdk/undiscriminated-unions/no-custom-config/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/undiscriminated-unions/v0/README.md b/seed/go-sdk/undiscriminated-unions/v0/README.md index 3a956815d648..4bc8532bff08 100644 --- a/seed/go-sdk/undiscriminated-unions/v0/README.md +++ b/seed/go-sdk/undiscriminated-unions/v0/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/union-query-parameters/README.md b/seed/go-sdk/union-query-parameters/README.md index e25287b43fe9..fbb303b59c88 100644 --- a/seed/go-sdk/union-query-parameters/README.md +++ b/seed/go-sdk/union-query-parameters/README.md @@ -133,11 +133,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/unions-with-local-date/README.md b/seed/go-sdk/unions-with-local-date/README.md index c4b49b0a8b9b..07ccfd019cb6 100644 --- a/seed/go-sdk/unions-with-local-date/README.md +++ b/seed/go-sdk/unions-with-local-date/README.md @@ -124,11 +124,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/unions/no-custom-config/README.md b/seed/go-sdk/unions/no-custom-config/README.md index 317668c70a8d..fcaec5e89ab7 100644 --- a/seed/go-sdk/unions/no-custom-config/README.md +++ b/seed/go-sdk/unions/no-custom-config/README.md @@ -124,11 +124,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/unions/package-name/README.md b/seed/go-sdk/unions/package-name/README.md index ebdb4a32ce21..1ec466435c13 100644 --- a/seed/go-sdk/unions/package-name/README.md +++ b/seed/go-sdk/unions/package-name/README.md @@ -124,11 +124,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/unions/v0/README.md b/seed/go-sdk/unions/v0/README.md index 317668c70a8d..fcaec5e89ab7 100644 --- a/seed/go-sdk/unions/v0/README.md +++ b/seed/go-sdk/unions/v0/README.md @@ -124,11 +124,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/unknown/README.md b/seed/go-sdk/unknown/README.md index 975a88761129..f9b292d37e42 100644 --- a/seed/go-sdk/unknown/README.md +++ b/seed/go-sdk/unknown/README.md @@ -127,11 +127,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/url-form-encoded/README.md b/seed/go-sdk/url-form-encoded/README.md index 82172266e0aa..26e948e08377 100644 --- a/seed/go-sdk/url-form-encoded/README.md +++ b/seed/go-sdk/url-form-encoded/README.md @@ -129,11 +129,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/validation/README.md b/seed/go-sdk/validation/README.md index d4fe3c54c179..31eec82cbe84 100644 --- a/seed/go-sdk/validation/README.md +++ b/seed/go-sdk/validation/README.md @@ -131,11 +131,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/variables/README.md b/seed/go-sdk/variables/README.md index f515c2897994..119358f1deba 100644 --- a/seed/go-sdk/variables/README.md +++ b/seed/go-sdk/variables/README.md @@ -124,11 +124,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/version-no-default/README.md b/seed/go-sdk/version-no-default/README.md index 119d3bdc7b2e..19168bb827eb 100644 --- a/seed/go-sdk/version-no-default/README.md +++ b/seed/go-sdk/version-no-default/README.md @@ -124,11 +124,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/version/README.md b/seed/go-sdk/version/README.md index 31d996a1a8eb..f40c493f237e 100644 --- a/seed/go-sdk/version/README.md +++ b/seed/go-sdk/version/README.md @@ -124,11 +124,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/websocket-inferred-auth/README.md b/seed/go-sdk/websocket-inferred-auth/README.md index e16b4040dd13..9a66ec44886f 100644 --- a/seed/go-sdk/websocket-inferred-auth/README.md +++ b/seed/go-sdk/websocket-inferred-auth/README.md @@ -144,11 +144,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. diff --git a/seed/go-sdk/x-fern-default/README.md b/seed/go-sdk/x-fern-default/README.md index 4fb91613f001..2300969b9b9b 100644 --- a/seed/go-sdk/x-fern-default/README.md +++ b/seed/go-sdk/x-fern-default/README.md @@ -128,11 +128,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly over the default exponential backoff. From 5dc2137294188cc4e74b4d937b7a278ab1f999f7 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 11:27:55 -0400 Subject: [PATCH 13/43] chore(ruby): update ruby-sdk-v2 seed (#15566) Co-authored-by: dsinghvi <10870189+dsinghvi@users.noreply.github.com> From 8729bff27983b5426ec212cce39f6ce9165422a5 Mon Sep 17 00:00:00 2001 From: patrick thornton <70873350+patrickthornton@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:30:08 -0400 Subject: [PATCH 14/43] fix(typescript): dedupe discriminant in generated SSE protocol-union wire tests (#15563) * fix(typescript): dedupe discriminant in generated SSE protocol-union wire tests * chore(typescript): update IR-to-JSONSchema snapshots for new SSE seed types --- ...sse-protocol-union-test-duplicate-keys.yml | 11 +++ .../src/test-generator/TestGenerator.ts | 50 ++++--------- .../type_completions_GroupCreatedEvent.json | 17 +++++ .../type_completions_GroupDeletedEvent.json | 17 +++++ ...letions_StreamEventDiscriminantInData.json | 51 ++++++++++++++ .../.fern/metadata.json | 3 +- .../server-sent-event-examples/reference.md | 54 ++++++++++++++ .../server-sent-event-examples/snippet.json | 12 ++++ .../resources/completions/client/Client.ts | 70 +++++++++++++++++++ .../StreamEventsDiscriminantInDataRequest.ts | 11 +++ .../completions/client/requests/index.ts | 1 + .../completions/types/GroupCreatedEvent.ts | 6 ++ .../completions/types/GroupDeletedEvent.ts | 6 ++ .../types/StreamEventDiscriminantInData.ts | 17 +++++ .../api/resources/completions/types/index.ts | 3 + .../tests/wire/completions.test.ts | 69 +++++++++++++++--- .../definition/completions.yml | 50 +++++++++++++ 17 files changed, 403 insertions(+), 45 deletions(-) create mode 100644 generators/typescript/sdk/changes/unreleased/fix-sse-protocol-union-test-duplicate-keys.yml create mode 100644 packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_GroupCreatedEvent.json create mode 100644 packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_GroupDeletedEvent.json create mode 100644 packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_StreamEventDiscriminantInData.json create mode 100644 seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/requests/StreamEventsDiscriminantInDataRequest.ts create mode 100644 seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/GroupCreatedEvent.ts create mode 100644 seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/GroupDeletedEvent.ts create mode 100644 seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/StreamEventDiscriminantInData.ts diff --git a/generators/typescript/sdk/changes/unreleased/fix-sse-protocol-union-test-duplicate-keys.yml b/generators/typescript/sdk/changes/unreleased/fix-sse-protocol-union-test-duplicate-keys.yml new file mode 100644 index 000000000000..89ee574bc2fb --- /dev/null +++ b/generators/typescript/sdk/changes/unreleased/fix-sse-protocol-union-test-duplicate-keys.yml @@ -0,0 +1,11 @@ +# yaml-language-server: $schema=../../../../../fern-changes-yml.schema.json + +- summary: | + Fix generated wire tests for SSE endpoints with protocol-discriminated unions. + The expected event assertion no longer wraps the deserialized data in a duplicate + discriminant key (which produced TS2783 "specified more than once" errors under + strict typecheck). When the example puts the discriminant inside the data payload + and leaves the SSE event line empty, the discriminant is now promoted onto the + event line before being stripped from the data, so the mocked wire body matches + what the runtime SDK produces. + type: fix diff --git a/generators/typescript/sdk/generator/src/test-generator/TestGenerator.ts b/generators/typescript/sdk/generator/src/test-generator/TestGenerator.ts index c3733865d3e7..4aeaf17817df 100644 --- a/generators/typescript/sdk/generator/src/test-generator/TestGenerator.ts +++ b/generators/typescript/sdk/generator/src/test-generator/TestGenerator.ts @@ -2,22 +2,22 @@ import { CaseConverter, getOriginalName, getWireValue } from "@fern-api/base-gen import { assertNever } from "@fern-api/core-utils"; import { FernIr } from "@fern-fern/ir-sdk"; import { - DependencyManager, + type DependencyManager, DependencyType, - ExportedFilePath, + type ExportedFilePath, getExampleEndpointCalls, getExampleEndpointCallsForTests, getParameterNameForRootExamplePathParameter, getParameterNameForRootPathParameter, getTextOfTsNode, - PackageId, - Reference + type PackageId, + type Reference } from "@fern-typescript/commons"; -import { FileContext, GeneratedSdkClientClass } from "@fern-typescript/contexts"; +import type { FileContext, GeneratedSdkClientClass } from "@fern-typescript/contexts"; import { camelCase, upperFirst } from "lodash-es"; import path from "path"; -import { Directory, ts } from "ts-morph"; -import { arrayOf, Code, code, literalOf } from "ts-poet"; +import { type Directory, ts } from "ts-morph"; +import { arrayOf, type Code, code, literalOf } from "ts-poet"; const DEFAULT_PACKAGE_PATH = "src"; @@ -1204,7 +1204,7 @@ describe("${serviceName}", () => { }); const sseExpectedEvents: Code | undefined = isSSEStreaming - ? this.getSseExpectedEvents({ endpoint, example, context }) + ? this.getSseExpectedEvents({ example, context }) : undefined; const generateEnvironment = () => { @@ -1538,11 +1538,9 @@ describe("${serviceName}", () => { } private getSseExpectedEvents({ - endpoint, example, context }: { - endpoint: FernIr.HttpEndpoint; example: FernIr.ExampleEndpointCall; context: FileContext; }): Code | undefined { @@ -1561,35 +1559,11 @@ describe("${serviceName}", () => { return undefined; } - // Determine the SSE protocol discriminant field, if any - let discriminantField: string | undefined; - const ssePayload = - endpoint.response?.body?.type === "streaming" && endpoint.response.body.value.type === "sse" - ? endpoint.response.body.value.payload - : undefined; - if (ssePayload != null && ssePayload.type === "named") { - const typeDeclaration = context.type.getTypeDeclaration(ssePayload); - if ( - typeDeclaration.shape.type === "union" && - typeDeclaration.shape.discriminatorContext === FernIr.UnionDiscriminatorContext.Protocol - ) { - // Use the deserialized discriminant name (camelCase when serde layer is enabled) - discriminantField = context.includeSerdeLayer - ? context.case.camelUnsafe(typeDeclaration.shape.discriminant) - : getWireValue(typeDeclaration.shape.discriminant); - } - } - const eventCodes = sseEvents.map((event) => { - // Build the deserialized (camelCase) representation of the event data const deserializedData = context.type.getGeneratedExample(event.data).build(context, { isForSnippet: true, isForResponse: true }); - if (discriminantField != null) { - // For protocol-discriminated unions, merge the discriminant field into the deserialized data - return code`{ ${literalOf(discriminantField)}: ${literalOf(event.event)}, ...${getTextOfTsNode(deserializedData)} }`; - } return code`${getTextOfTsNode(deserializedData)}`; }); return code`${arrayOf(...eventCodes)}`; @@ -1756,6 +1730,7 @@ describe("${serviceName}", () => { } const sseLines = events.map((event) => { let dataJson: unknown = event.data.jsonExample; + let eventType = event.event; if ( discriminantField != null && dataJson != null && @@ -1763,10 +1738,15 @@ describe("${serviceName}", () => { !Array.isArray(dataJson) ) { const copy = { ...(dataJson as Record) }; + // If the example puts the discriminant inside the data payload, + // promote it onto the SSE event line before stripping. + if (discriminantField in copy && typeof copy[discriminantField] === "string") { + eventType = copy[discriminantField] as string; + } delete copy[discriminantField]; dataJson = copy; } - return `event: ${event.event}\ndata: ${JSON.stringify(dataJson)}\n`; + return `event: ${eventType}\ndata: ${JSON.stringify(dataJson)}\n`; }); return code`${literalOf(sseLines.join("\n") + "\n")}`; }, diff --git a/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_GroupCreatedEvent.json b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_GroupCreatedEvent.json new file mode 100644 index 000000000000..74ad8f134f56 --- /dev/null +++ b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_GroupCreatedEvent.json @@ -0,0 +1,17 @@ +{ + "type": "object", + "properties": { + "offset": { + "type": "string" + }, + "group_id": { + "type": "string" + } + }, + "required": [ + "offset", + "group_id" + ], + "additionalProperties": false, + "definitions": {} +} \ No newline at end of file diff --git a/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_GroupDeletedEvent.json b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_GroupDeletedEvent.json new file mode 100644 index 000000000000..74ad8f134f56 --- /dev/null +++ b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_GroupDeletedEvent.json @@ -0,0 +1,17 @@ +{ + "type": "object", + "properties": { + "offset": { + "type": "string" + }, + "group_id": { + "type": "string" + } + }, + "required": [ + "offset", + "group_id" + ], + "additionalProperties": false, + "definitions": {} +} \ No newline at end of file diff --git a/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_StreamEventDiscriminantInData.json b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_StreamEventDiscriminantInData.json new file mode 100644 index 000000000000..f6fe15f3bdf3 --- /dev/null +++ b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/server-sent-event-examples/type_completions_StreamEventDiscriminantInData.json @@ -0,0 +1,51 @@ +{ + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "group.created", + "group.deleted" + ] + } + }, + "oneOf": [ + { + "properties": { + "type": { + "const": "group.created" + }, + "offset": { + "type": "string" + }, + "group_id": { + "type": "string" + } + }, + "required": [ + "type", + "offset", + "group_id" + ] + }, + { + "properties": { + "type": { + "const": "group.deleted" + }, + "offset": { + "type": "string" + }, + "group_id": { + "type": "string" + } + }, + "required": [ + "type", + "offset", + "group_id" + ] + } + ], + "definitions": {} +} \ No newline at end of file diff --git a/seed/ts-sdk/server-sent-event-examples/.fern/metadata.json b/seed/ts-sdk/server-sent-event-examples/.fern/metadata.json index 5789995ae525..9ea68298004b 100644 --- a/seed/ts-sdk/server-sent-event-examples/.fern/metadata.json +++ b/seed/ts-sdk/server-sent-event-examples/.fern/metadata.json @@ -3,8 +3,7 @@ "generatorName": "fernapi/fern-typescript-sdk", "generatorVersion": "local", "originGitCommit": "DUMMY", - "invokedBy": "ci", + "invokedBy": "manual", "requestedVersion": "0.0.1", - "ciProvider": "github", "sdkVersion": "0.0.1" } diff --git a/seed/ts-sdk/server-sent-event-examples/reference.md b/seed/ts-sdk/server-sent-event-examples/reference.md index 42ea3988cff5..953f87082ad6 100644 --- a/seed/ts-sdk/server-sent-event-examples/reference.md +++ b/seed/ts-sdk/server-sent-event-examples/reference.md @@ -104,6 +104,60 @@ for await (const item of response) { + + + + +
client.completions.streamEventsDiscriminantInData({ ...params }) -> core.Stream<SeedServerSentEvents.StreamEventDiscriminantInData> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.completions.streamEventsDiscriminantInData({ + query: "query" +}); +for await (const item of response) { + console.log(item); +} + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `SeedServerSentEvents.StreamEventsDiscriminantInDataRequest` + +
+
+ +
+
+ +**requestOptions:** `CompletionsClient.RequestOptions` + +
+
+
+
+ +
diff --git a/seed/ts-sdk/server-sent-event-examples/snippet.json b/seed/ts-sdk/server-sent-event-examples/snippet.json index ce027d360702..0a09ec74fda1 100644 --- a/seed/ts-sdk/server-sent-event-examples/snippet.json +++ b/seed/ts-sdk/server-sent-event-examples/snippet.json @@ -48,6 +48,18 @@ }, "example_identifier": "Bad request" }, + { + "id": { + "path": "/stream-events-discriminant-in-data", + "method": "POST", + "identifier_override": "endpoint_completions.streamEventsDiscriminantInData" + }, + "snippet": { + "type": "typescript", + "client": "import { SeedServerSentEventsClient } from \"@fern/server-sent-event-examples\";\n\nconst client = new SeedServerSentEventsClient({ environment: \"YOUR_BASE_URL\" });\nconst response = await client.completions.streamEventsDiscriminantInData({\n query: \"query\"\n});\nfor await (const item of response) {\n console.log(item);\n}\n" + }, + "example_identifier": "Stream events where discriminant is embedded in data and SSE event line is empty" + }, { "id": { "path": "/stream-events-context-protocol", diff --git a/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/Client.ts b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/Client.ts index badb0142dca3..6d8fc619a4a2 100644 --- a/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/Client.ts +++ b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/Client.ts @@ -151,6 +151,76 @@ export class CompletionsClient { return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/stream-events"); } + public streamEventsDiscriminantInData( + request: SeedServerSentEvents.StreamEventsDiscriminantInDataRequest, + requestOptions?: CompletionsClient.RequestOptions, + ): core.HttpResponsePromise> { + return core.HttpResponsePromise.fromPromise(this.__streamEventsDiscriminantInData(request, requestOptions)); + } + + private async __streamEventsDiscriminantInData( + request: SeedServerSentEvents.StreamEventsDiscriminantInDataRequest, + requestOptions?: CompletionsClient.RequestOptions, + ): Promise>> { + const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)), + "stream-events-discriminant-in-data", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + requestType: "json", + body: request, + responseType: "sse", + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: new core.Stream({ + stream: _response.body, + parse: (data) => data as any, + signal: requestOptions?.abortSignal, + eventShape: { + type: "sse", + eventDiscriminator: "type", + }, + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new SeedServerSentEvents.BadRequestError( + _response.error.body as string, + _response.rawResponse, + ); + default: + throw new errors.SeedServerSentEventsError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/stream-events-discriminant-in-data", + ); + } + public streamEventsContextProtocol( request: SeedServerSentEvents.StreamEventsContextProtocolRequest, requestOptions?: CompletionsClient.RequestOptions, diff --git a/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/requests/StreamEventsDiscriminantInDataRequest.ts b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/requests/StreamEventsDiscriminantInDataRequest.ts new file mode 100644 index 000000000000..fcb8d1fb9e58 --- /dev/null +++ b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/requests/StreamEventsDiscriminantInDataRequest.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * query: "query" + * } + */ +export interface StreamEventsDiscriminantInDataRequest { + query: string; +} diff --git a/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/requests/index.ts b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/requests/index.ts index 50c91446bf5b..ad30cd4bc30e 100644 --- a/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/requests/index.ts +++ b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/client/requests/index.ts @@ -1,3 +1,4 @@ export type { StreamCompletionRequest } from "./StreamCompletionRequest.js"; export type { StreamEventsContextProtocolRequest } from "./StreamEventsContextProtocolRequest.js"; +export type { StreamEventsDiscriminantInDataRequest } from "./StreamEventsDiscriminantInDataRequest.js"; export type { StreamEventsRequest } from "./StreamEventsRequest.js"; diff --git a/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/GroupCreatedEvent.ts b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/GroupCreatedEvent.ts new file mode 100644 index 000000000000..4087055ac352 --- /dev/null +++ b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/GroupCreatedEvent.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface GroupCreatedEvent { + offset: string; + group_id: string; +} diff --git a/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/GroupDeletedEvent.ts b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/GroupDeletedEvent.ts new file mode 100644 index 000000000000..d0e438631dee --- /dev/null +++ b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/GroupDeletedEvent.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface GroupDeletedEvent { + offset: string; + group_id: string; +} diff --git a/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/StreamEventDiscriminantInData.ts b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/StreamEventDiscriminantInData.ts new file mode 100644 index 000000000000..fe0678623a5a --- /dev/null +++ b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/StreamEventDiscriminantInData.ts @@ -0,0 +1,17 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as SeedServerSentEvents from "../../../index.js"; + +export type StreamEventDiscriminantInData = + | SeedServerSentEvents.StreamEventDiscriminantInData.GroupCreated + | SeedServerSentEvents.StreamEventDiscriminantInData.GroupDeleted; + +export namespace StreamEventDiscriminantInData { + export interface GroupCreated extends SeedServerSentEvents.GroupCreatedEvent { + type: "group.created"; + } + + export interface GroupDeleted extends SeedServerSentEvents.GroupDeletedEvent { + type: "group.deleted"; + } +} diff --git a/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/index.ts b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/index.ts index 1ba8e00bbd7f..557708048165 100644 --- a/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/index.ts +++ b/seed/ts-sdk/server-sent-event-examples/src/api/resources/completions/types/index.ts @@ -1,6 +1,9 @@ export * from "./CompletionEvent.js"; export * from "./ErrorEvent.js"; export * from "./EventEvent.js"; +export * from "./GroupCreatedEvent.js"; +export * from "./GroupDeletedEvent.js"; export * from "./StreamEvent.js"; export * from "./StreamEventContextProtocol.js"; +export * from "./StreamEventDiscriminantInData.js"; export * from "./StreamedCompletion.js"; diff --git a/seed/ts-sdk/server-sent-event-examples/tests/wire/completions.test.ts b/seed/ts-sdk/server-sent-event-examples/tests/wire/completions.test.ts index 34c76f8b07a6..687e0fffd3ff 100644 --- a/seed/ts-sdk/server-sent-event-examples/tests/wire/completions.test.ts +++ b/seed/ts-sdk/server-sent-event-examples/tests/wire/completions.test.ts @@ -119,6 +119,65 @@ describe("CompletionsClient", () => { }).rejects.toThrow(SeedServerSentEvents.BadRequestError); }); + test("streamEventsDiscriminantInData (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SeedServerSentEventsClient({ maxRetries: 0, environment: server.baseUrl }); + const rawRequestBody = { query: "query" }; + const rawResponseBody = + 'event: group.created\ndata: {"offset":"offset-1","group_id":"g1"}\n\nevent: group.deleted\ndata: {"offset":"offset-2","group_id":"g2"}\n\n'; + + server + .mockEndpoint() + .post("/stream-events-discriminant-in-data") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .sseBody(rawResponseBody) + .build(); + + const response = await client.completions.streamEventsDiscriminantInData({ + query: "query", + }); + const events: unknown[] = []; + for await (const event of response) { + events.push(event); + } + expect(events).toEqual([ + { + type: "group.created", + offset: "offset-1", + group_id: "g1", + }, + { + type: "group.deleted", + offset: "offset-2", + group_id: "g2", + }, + ]); + }); + + test("streamEventsDiscriminantInData (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SeedServerSentEventsClient({ maxRetries: 0, environment: server.baseUrl }); + const rawRequestBody = { query: "query" }; + const rawResponseBody = "string"; + + server + .mockEndpoint() + .post("/stream-events-discriminant-in-data") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.completions.streamEventsDiscriminantInData({ + query: "query", + }); + }).rejects.toThrow(SeedServerSentEvents.BadRequestError); + }); + test("streamEventsContextProtocol (1)", async () => { const server = mockServerPool.createServer(); const client = new SeedServerSentEventsClient({ maxRetries: 0, environment: server.baseUrl }); @@ -145,17 +204,11 @@ describe("CompletionsClient", () => { expect(events).toEqual([ { event: "completion", - ...{ - event: "completion", - content: "hello", - }, + content: "hello", }, { event: "error", - ...{ - event: "error", - error: "something went wrong", - }, + error: "something went wrong", }, ]); }); diff --git a/test-definitions/fern/apis/server-sent-event-examples/definition/completions.yml b/test-definitions/fern/apis/server-sent-event-examples/definition/completions.yml index d30a41114240..645fb40587e5 100644 --- a/test-definitions/fern/apis/server-sent-event-examples/definition/completions.yml +++ b/test-definitions/fern/apis/server-sent-event-examples/definition/completions.yml @@ -27,6 +27,24 @@ types: error: ErrorEvent event: EventEvent + GroupCreatedEvent: + properties: + offset: string + group_id: string + + GroupDeletedEvent: + properties: + offset: string + group_id: string + + StreamEventDiscriminantInData: + discriminant: + value: type + context: protocol + union: + "group.created": GroupCreatedEvent + "group.deleted": GroupDeletedEvent + StreamEvent: discriminant: value: event @@ -113,6 +131,38 @@ service: error: BadRequestError body: "bad request" + streamEventsDiscriminantInData: + method: POST + path: /stream-events-discriminant-in-data + request: + name: StreamEventsDiscriminantInDataRequest + body: + properties: + query: string + response-stream: + type: StreamEventDiscriminantInData + format: sse + errors: + - BadRequestError + examples: + - name: "Stream events where discriminant is embedded in data and SSE event line is empty" + request: + query: "query" + response: + stream: + # The customer-facing SSE wire pattern: server sends an empty `event:` + # line and the union discriminant travels inside the data payload. + - event: "" + data: + type: "group.created" + offset: "offset-1" + group_id: "g1" + - event: "" + data: + type: "group.deleted" + offset: "offset-2" + group_id: "g2" + streamEventsContextProtocol: method: POST path: /stream-events-context-protocol From 9fd3e8d7b733eb44f84361377f3b097540bbe0ac Mon Sep 17 00:00:00 2001 From: Naman Anand Date: Wed, 29 Apr 2026 22:02:55 +0530 Subject: [PATCH 15/43] feat(php): add config-driven retryStatusCodes with legacy/recommended modes (#15420) * fix(php): only retry on 408, 429, and 5xx except 500 Updated shouldRetry to use (>= 501 && < 600) instead of >= 500, so that 500 Internal Server Error is no longer retried. * fix: add 5XX hyperlink to features.yml to match TS PR pattern * fix(php): update changelog wording to match PR pattern * fix(php): fix broken retry tests and add 500/600 boundary tests Co-Authored-By: Claude Sonnet 4.6 * fix(php): remove invalid status 600 retry test (PSR-7 rejects status outside 1xx-5xx) * feat(php): add config-driven retryStatusCodes with legacy/recommended modes - Add retryStatusCodes field to BasePhpCustomConfigSchema (legacy | recommended) - Legacy (default): 408, 429, >= 500 - Recommended: 408, 429, 502, 503, 504 (excludes 500 Internal Server Error) - Apply string replacement in PhpProject.ts when config is recommended - Create 3.0.0 migration to auto-pin legacy for existing users - Register PHP SDK migrations in main index - Update features.yml documenting both modes - Revert seed RetryDecoratingClient.php and RawClientTest.php to legacy behavior * fix: biome formatting in PhpProject.ts * ci: retry after Docker cleanup failures * fix: sort imports alphabetically for biome * fix: mark @boundaryml/baml as external in php-sdk build to fix esbuild native module errors * refactor: use template variable for retryStatusCodes instead of find/replace * fix: drop @boundaryml/baml external from build.mjs (now in shared build-utils) * refactor(php): use {{RETRY_STATUS_CHECK}} placeholder pattern like TS/Rust Replace EJS conditionals with {{RETRY_STATUS_CHECK}} and {{RETRY_STATUS_CODES_ARRAY}} placeholders resolved by PhpProject.ts, matching the identical pattern used in TS and Rust generators. * fix(php): biome format fix * fix: update migration test - use fern-openapi as undefined generator --------- Co-authored-by: Claude Sonnet 4.6 Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../Client/RetryDecoratingClient.Template.php | 5 ++-- generators/php/base/src/project/PhpProject.ts | 25 +++++++++++------ .../BasePhpCustomConfigSchema.ts | 1 + .../unreleased/fix-retry-status-codes.yml | 6 ++++ generators/php/sdk/features.yml | 7 ++++- .../src/__test__/index.test.ts | 28 +++++++++++++++++++ .../src/generators/php/migrations/3.0.0.ts | 25 +++++++++++++++++ .../src/generators/php/migrations/index.ts | 8 ++++++ packages/generator-migrations/src/index.ts | 4 +++ 9 files changed, 96 insertions(+), 13 deletions(-) create mode 100644 generators/php/sdk/changes/unreleased/fix-retry-status-codes.yml create mode 100644 packages/generator-migrations/src/generators/php/migrations/3.0.0.ts create mode 100644 packages/generator-migrations/src/generators/php/migrations/index.ts diff --git a/generators/php/base/src/asIs/Client/RetryDecoratingClient.Template.php b/generators/php/base/src/asIs/Client/RetryDecoratingClient.Template.php index 368cb8fa269a..4511848805db 100644 --- a/generators/php/base/src/asIs/Client/RetryDecoratingClient.Template.php +++ b/generators/php/base/src/asIs/Client/RetryDecoratingClient.Template.php @@ -9,7 +9,7 @@ class RetryDecoratingClient implements ClientInterface { - private const RETRY_STATUS_CODES = [408, 429]; + private const RETRY_STATUS_CODES = {{RETRY_STATUS_CODES_ARRAY}}; private const MAX_RETRY_DELAY = 60000; // 60 seconds in milliseconds private const JITTER_FACTOR = 0.2; // 20% random jitter @@ -150,8 +150,7 @@ private function shouldRetry( } if ($response !== null) { - return $response->getStatusCode() >= 500 || - in_array($response->getStatusCode(), self::RETRY_STATUS_CODES); + return {{RETRY_STATUS_CHECK}}; } return false; diff --git a/generators/php/base/src/project/PhpProject.ts b/generators/php/base/src/project/PhpProject.ts index 91093cf2229a..af7f5839185e 100644 --- a/generators/php/base/src/project/PhpProject.ts +++ b/generators/php/base/src/project/PhpProject.ts @@ -129,15 +129,22 @@ export class PhpProject extends AbstractProject { const contents = (await readFile(getAsIsFilepath(filename))).toString(); - return new File( - filename.replace(".Template", ""), - RelativeFilePath.of(""), - this.replaceTemplate({ - contents, - namespace: this.getNestedNamespace({ namespace, filename }), - extraTemplateVars - }) - ); + let rendered = this.replaceTemplate({ + contents, + namespace: this.getNestedNamespace({ namespace, filename }), + extraTemplateVars + }); + + const retryStatusCodesArray = + this.context.customConfig.retryStatusCodes === "recommended" ? "[408, 429, 502, 503, 504]" : "[408, 429]"; + const retryStatusCheck = + this.context.customConfig.retryStatusCodes === "recommended" + ? "in_array($response->getStatusCode(), self::RETRY_STATUS_CODES)" + : "$response->getStatusCode() >= 500 ||\n in_array($response->getStatusCode(), self::RETRY_STATUS_CODES)"; + rendered = rendered.replace(/\{\{RETRY_STATUS_CODES_ARRAY\}\}/g, retryStatusCodesArray); + rendered = rendered.replace(/\{\{RETRY_STATUS_CHECK\}\}/g, retryStatusCheck); + + return new File(filename.replace(".Template", ""), RelativeFilePath.of(""), rendered); } private async createGitHubWorkflowsDirectory(): Promise { diff --git a/generators/php/codegen/src/custom-config/BasePhpCustomConfigSchema.ts b/generators/php/codegen/src/custom-config/BasePhpCustomConfigSchema.ts index 6e9548b8cf9a..3b9658855839 100644 --- a/generators/php/codegen/src/custom-config/BasePhpCustomConfigSchema.ts +++ b/generators/php/codegen/src/custom-config/BasePhpCustomConfigSchema.ts @@ -12,6 +12,7 @@ export const BasePhpCustomConfigSchema = z.object({ customReadmeSections: z.array(CustomReadmeSectionSchema).optional(), offsetSemantics: z.enum(["item-index", "page-index"]).optional(), omitFernHeaders: z.boolean().optional(), + retryStatusCodes: z.optional(z.enum(["legacy", "recommended"])), // Deprecated; use clientName instead. "client-class-name": z.string().optional() }); diff --git a/generators/php/sdk/changes/unreleased/fix-retry-status-codes.yml b/generators/php/sdk/changes/unreleased/fix-retry-status-codes.yml new file mode 100644 index 000000000000..21ac5637307a --- /dev/null +++ b/generators/php/sdk/changes/unreleased/fix-retry-status-codes.yml @@ -0,0 +1,6 @@ +- summary: | + Add `retryStatusCodes` configuration option (`legacy` | `recommended`). The default + `legacy` mode preserves existing behavior (retries 408, 429, and all >= 500). The + `recommended` mode only retries 408, 429, 502, 503, 504 (excludes 500 Internal + Server Error to avoid retrying non-idempotent failures). + type: feat diff --git a/generators/php/sdk/features.yml b/generators/php/sdk/features.yml index 51f88b36b9b1..387fb7492e50 100644 --- a/generators/php/sdk/features.yml +++ b/generators/php/sdk/features.yml @@ -33,7 +33,12 @@ features: - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) - - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) + - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + + The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + + - `legacy` (default): Retries `408`, `429`, and all `>= 500` + - `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/packages/generator-migrations/src/__test__/index.test.ts b/packages/generator-migrations/src/__test__/index.test.ts index 6f7b784ac767..cac26591e51d 100644 --- a/packages/generator-migrations/src/__test__/index.test.ts +++ b/packages/generator-migrations/src/__test__/index.test.ts @@ -177,6 +177,34 @@ describe("@fern-api/generator-migrations", () => { }); }); + describe("PHP SDK migrations", () => { + it("includes PHP SDK migration entries", () => { + expect(migrations["fernapi/fern-php-sdk"]).toBeDefined(); + expect(migrations["fernapi/fern-php-sdk"]?.migrations).toBeDefined(); + expect(Array.isArray(migrations["fernapi/fern-php-sdk"]?.migrations)).toBe(true); + }); + + it("PHP SDK migrations have correct structure", () => { + const module = migrations["fernapi/fern-php-sdk"]; + + expect(module).toBeDefined(); + expect(module?.migrations.length).toBeGreaterThan(0); + + for (const migration of module?.migrations ?? []) { + expect(migration).toHaveProperty("version"); + expect(migration).toHaveProperty("migrateGeneratorConfig"); + expect(migration).toHaveProperty("migrateGeneratorsYml"); + } + }); + + it("PHP SDK migrations are in semver order", () => { + const module = migrations["fernapi/fern-php-sdk"]; + const versions = module?.migrations.map((m) => m.version) ?? []; + + expect(versions).toEqual(["3.0.0"]); + }); + }); + describe("Ruby SDK migrations", () => { it("includes Ruby SDK migration entries", () => { expect(migrations["fernapi/fern-ruby-sdk"]).toBeDefined(); diff --git a/packages/generator-migrations/src/generators/php/migrations/3.0.0.ts b/packages/generator-migrations/src/generators/php/migrations/3.0.0.ts new file mode 100644 index 000000000000..5cfba256736b --- /dev/null +++ b/packages/generator-migrations/src/generators/php/migrations/3.0.0.ts @@ -0,0 +1,25 @@ +import type { Migration } from "@fern-api/migrations-base"; +import { migrateConfig } from "@fern-api/migrations-base"; + +// Migration for version 3.0.0 +// +// Context: +// Version 3.0.0 changes the default retry behavior to only retry on transient +// 5xx status codes (408, 429, 502, 503, 504), excluding 500 Internal Server Error. +// +// Changed Defaults: +// - retryStatusCodes: undefined (legacy behavior: 408, 429, >= 500) → "recommended" (408, 429, 502, 503, 504) +// +// Migration Strategy: +// This migration pins existing users to "legacy" so their retry behavior +// does not change on upgrade. New users get "recommended" by default. +export const migration_3_0_0: Migration = { + version: "3.0.0", + + migrateGeneratorConfig: ({ config }) => + migrateConfig(config, (draft) => { + draft.retryStatusCodes ??= "legacy"; + }), + + migrateGeneratorsYml: ({ document }) => document +}; diff --git a/packages/generator-migrations/src/generators/php/migrations/index.ts b/packages/generator-migrations/src/generators/php/migrations/index.ts new file mode 100644 index 000000000000..64cb04eafbe6 --- /dev/null +++ b/packages/generator-migrations/src/generators/php/migrations/index.ts @@ -0,0 +1,8 @@ +import type { MigrationModule } from "@fern-api/migrations-base"; +import { migration_3_0_0 } from "./3.0.0.js"; + +const phpSdkMigrations: MigrationModule = { + migrations: [migration_3_0_0] +}; + +export default phpSdkMigrations; diff --git a/packages/generator-migrations/src/index.ts b/packages/generator-migrations/src/index.ts index 0f81c3d042a8..d6ee2c882fe8 100644 --- a/packages/generator-migrations/src/index.ts +++ b/packages/generator-migrations/src/index.ts @@ -11,6 +11,7 @@ import csharpSdkMigrations from "./generators/csharp/migrations/index.js"; import goSdkMigrations from "./generators/go/migrations/index.js"; import javaSdkMigrations from "./generators/java/migrations/index.js"; import javaModelMigrations from "./generators/java-model/migrations/index.js"; +import phpSdkMigrations from "./generators/php/migrations/index.js"; import pythonSdkMigrations from "./generators/python/migrations/index.js"; import rubySdkMigrations from "./generators/ruby/migrations/index.js"; import rustSdkMigrations from "./generators/rust/migrations/index.js"; @@ -45,6 +46,9 @@ export const migrations: Record = { "fernapi/fern-fastapi-server": pythonSdkMigrations, "fernapi/fern-pydantic-model": pythonSdkMigrations, + // PHP SDK + "fernapi/fern-php-sdk": phpSdkMigrations, + // Ruby SDK "fernapi/fern-ruby-sdk": rubySdkMigrations, From 96c89c7768f60a66ad77edc364531f3a0638d6e1 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:33:04 -0400 Subject: [PATCH 16/43] fix(cli): make OpenAPI validation non-fatal during docs generation (#15564) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: kenny --- .../docs-gen-skip-offending-api.yml | 9 +++++ .../generate/generateDocsWorkspace.ts | 37 ++++++++++++------- 2 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 packages/cli/cli/changes/unreleased/docs-gen-skip-offending-api.yml diff --git a/packages/cli/cli/changes/unreleased/docs-gen-skip-offending-api.yml b/packages/cli/cli/changes/unreleased/docs-gen-skip-offending-api.yml new file mode 100644 index 000000000000..2061a1fdb51e --- /dev/null +++ b/packages/cli/cli/changes/unreleased/docs-gen-skip-offending-api.yml @@ -0,0 +1,9 @@ +# yaml-language-server: $schema=../../../../../fern-changes-yml.schema.json + +- summary: | + Make OpenAPI validation errors non-fatal during docs generation. Previously, + validation issues like "Self-referencing circular pointer" or parameter name + collisions would abort `fern generate --docs` entirely. The CLI now logs + warnings and skips the offending API workspace so the rest of the docs can + still be published. These validations remain errors in `fern check`. + type: fix diff --git a/packages/cli/cli/src/commands/generate/generateDocsWorkspace.ts b/packages/cli/cli/src/commands/generate/generateDocsWorkspace.ts index 48e3c1c36ff5..c879363f032a 100644 --- a/packages/cli/cli/src/commands/generate/generateDocsWorkspace.ts +++ b/packages/cli/cli/src/commands/generate/generateDocsWorkspace.ts @@ -1,5 +1,6 @@ import { createOrganizationIfDoesNotExist, FernToken, FernUserToken, getToken } from "@fern-api/auth"; import { createFdrService } from "@fern-api/core"; +import { extractErrorMessage } from "@fern-api/core-utils"; import { filterOssWorkspaces } from "@fern-api/docs-resolver"; import { Rules } from "@fern-api/docs-validator"; import { FdrAPI } from "@fern-api/fdr-sdk"; @@ -178,31 +179,41 @@ export async function generateDocsWorkspace({ excludeRules: getExcludeRules(brokenLinks, strictBrokenLinks) }); - // Validate OpenAPI specs for issues that would cause runtime errors on the docs site + // Validate OpenAPI specs — log warnings for issues but never block docs generation. + // Workspaces that fail validation or throw during loading are excluded from the + // generation step so the rest of the docs can still be published. + const skippedWorkspacePaths = new Set(); const ossWorkspacesForValidation = await filterOssWorkspaces(project); for (const ossWorkspace of ossWorkspacesForValidation) { - const violations = await validateOSSWorkspace(ossWorkspace, context); - const errors = violations.filter((v) => v.severity === "fatal" || v.severity === "error"); - if (errors.length > 0) { - for (const error of errors) { - context.logger.error(`${error.relativeFilepath}: ${error.message}`); + try { + const violations = await validateOSSWorkspace(ossWorkspace, context); + const errors = violations.filter((v) => v.severity === "fatal" || v.severity === "error"); + if (errors.length > 0) { + for (const error of errors) { + context.logger.warn(`${error.relativeFilepath}: ${error.message}`); + } + context.logger.warn( + `Skipping API workspace at ${ossWorkspace.absoluteFilePath} due to ${errors.length} validation error${errors.length !== 1 ? "s" : ""}. ` + + "Run fern check for details." + ); + skippedWorkspacePaths.add(ossWorkspace.absoluteFilePath); } - context.failAndThrow( - `OpenAPI spec validation failed with ${errors.length} error${errors.length !== 1 ? "s" : ""}. ` + - "Fix the errors above before generating docs.", - undefined, - { code: CliError.Code.ValidationError } + } catch (error) { + context.logger.warn( + `Skipping API workspace at ${ossWorkspace.absoluteFilePath}: ${extractErrorMessage(error)}` ); + skippedWorkspacePaths.add(ossWorkspace.absoluteFilePath); } } context.logger.info("Validation complete, starting remote docs generation..."); const filterStart = performance.now(); - const ossWorkspaces = await filterOssWorkspaces(project); + const allOssWorkspaces = await filterOssWorkspaces(project); + const ossWorkspaces = allOssWorkspaces.filter((ws) => !skippedWorkspacePaths.has(ws.absoluteFilePath)); const filterTime = performance.now() - filterStart; context.logger.debug( - `Filtered OSS workspaces (${ossWorkspaces.length} workspaces) in ${filterTime.toFixed(0)}ms` + `Filtered OSS workspaces (${ossWorkspaces.length} workspaces, ${skippedWorkspacePaths.size} skipped) in ${filterTime.toFixed(0)}ms` ); const generationStart = performance.now(); From 06753dcc3240e7ac80be86622bb2de1ea7b57feb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 16:34:09 +0000 Subject: [PATCH 17/43] chore(cli): release 4.107.1 --- .../docs-gen-skip-offending-api.yml | 0 packages/cli/cli/versions.yml | 11 +++++++++++ 2 files changed, 11 insertions(+) rename packages/cli/cli/changes/{unreleased => 4.107.1}/docs-gen-skip-offending-api.yml (100%) diff --git a/packages/cli/cli/changes/unreleased/docs-gen-skip-offending-api.yml b/packages/cli/cli/changes/4.107.1/docs-gen-skip-offending-api.yml similarity index 100% rename from packages/cli/cli/changes/unreleased/docs-gen-skip-offending-api.yml rename to packages/cli/cli/changes/4.107.1/docs-gen-skip-offending-api.yml diff --git a/packages/cli/cli/versions.yml b/packages/cli/cli/versions.yml index 48bc3ce22cf9..3fed85a70536 100644 --- a/packages/cli/cli/versions.yml +++ b/packages/cli/cli/versions.yml @@ -1,4 +1,15 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 4.107.1 + changelogEntry: + - summary: | + Make OpenAPI validation errors non-fatal during docs generation. Previously, + validation issues like "Self-referencing circular pointer" or parameter name + collisions would abort `fern generate --docs` entirely. The CLI now logs + warnings and skips the offending API workspace so the rest of the docs can + still be published. These validations remain errors in `fern check`. + type: fix + createdAt: "2026-04-29" + irVersion: 66 - version: 4.107.0 changelogEntry: - summary: | From 48d87e1da5f2bfde7a3e3743df319cf86ac3435b Mon Sep 17 00:00:00 2001 From: patrick thornton <70873350+patrickthornton@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:34:21 -0400 Subject: [PATCH 18/43] fix(java): strip optional/nullable wrappers from snippet list items (#15568) --- .../src/EndpointSnippetGenerator.ts | 50 +++++++++---------- .../fix-list-item-wrappers-in-snippets.yml | 10 ++++ 2 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 generators/java/sdk/changes/unreleased/fix-list-item-wrappers-in-snippets.yml diff --git a/generators/java-v2/dynamic-snippets/src/EndpointSnippetGenerator.ts b/generators/java-v2/dynamic-snippets/src/EndpointSnippetGenerator.ts index 3c57ee78654f..22b108102610 100644 --- a/generators/java-v2/dynamic-snippets/src/EndpointSnippetGenerator.ts +++ b/generators/java-v2/dynamic-snippets/src/EndpointSnippetGenerator.ts @@ -17,37 +17,35 @@ const STRING_TYPE_REFERENCE: FernIr.dynamic.TypeReference = { value: "STRING" }; +function stripOptionalAndNullable(item: FernIr.dynamic.TypeReference): FernIr.dynamic.TypeReference { + let current = item; + while (current.type === "optional" || current.type === "nullable") { + current = current.value; + } + return current; +} + /** - * For query parameters with allow-multiple and optional types, the Dynamic IR produces - * optional>> or list>. However, Java SDK builders have - * convenience overloads that accept List directly. This function unwraps the optional - * from list items so we generate List instead of List>. - * - * Note: We only unwrap "optional", not "nullable". Nullable list items (list>) - * are a distinct case where items genuinely can be null, and the SDK expects List>. + * For query parameters with allow-multiple, the Dynamic IR may produce list items wrapped + * in optional<...>, nullable<...>, or both (e.g. list>>). The Java SDK + * builders only expose List overloads — there is no List> or List>. + * Strip those wrappers from list items so we generate List. */ -function unwrapOptionalFromListItems(typeReference: FernIr.dynamic.TypeReference): FernIr.dynamic.TypeReference { +function stripListItemWrappers(typeReference: FernIr.dynamic.TypeReference): FernIr.dynamic.TypeReference { if (typeReference.type === "optional" && typeReference.value.type === "list") { - const listType = typeReference.value; - const itemType = listType.value; - if (itemType.type === "optional") { - return { - type: "optional", - value: { - type: "list", - value: itemType.value - } - }; + const itemType = typeReference.value.value; + const stripped = stripOptionalAndNullable(itemType); + if (stripped === itemType) { + return typeReference; } + return { type: "optional", value: { type: "list", value: stripped } }; } if (typeReference.type === "list") { - const itemType = typeReference.value; - if (itemType.type === "optional") { - return { - type: "list", - value: itemType.value - }; + const stripped = stripOptionalAndNullable(typeReference.value); + if (stripped === typeReference.value) { + return typeReference; } + return { type: "list", value: stripped }; } return typeReference; } @@ -825,9 +823,7 @@ export class EndpointSnippetGenerator { const queryParameterFields = sortedQueryParameters.map((queryParameter) => ({ name: this.context.getMethodName(queryParameter.name.name), value: this.context.dynamicTypeLiteralMapper.convert({ - // Unwrap optional from list items for allow-multiple query params. - // Java SDK builders have convenience overloads that accept List. - typeReference: unwrapOptionalFromListItems(queryParameter.typeReference), + typeReference: stripListItemWrappers(queryParameter.typeReference), value: queryParameter.value, as: "request" }) diff --git a/generators/java/sdk/changes/unreleased/fix-list-item-wrappers-in-snippets.yml b/generators/java/sdk/changes/unreleased/fix-list-item-wrappers-in-snippets.yml new file mode 100644 index 000000000000..7b03231263cf --- /dev/null +++ b/generators/java/sdk/changes/unreleased/fix-list-item-wrappers-in-snippets.yml @@ -0,0 +1,10 @@ +- summary: | + Fix Java SDK snippet and wire test generation for `allow-multiple` query + parameters when `coerce-optional-schemas-to-nullable: true` is set. + Previously, list items wrapped in `optional<...>` and/or `nullable<...>` + produced calls like `.strategy(Arrays.asList(Optional.of(...)))`, which + failed to compile because the generated builders only expose `List` + overloads (no `List>` or `List>`). The snippet + generator now strips both `optional` and `nullable` wrappers from list + items, so the emitted code matches an existing builder signature. + type: fix From 151e9cd7972a8e6bb950418cdc0711fac9194adc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 16:34:35 +0000 Subject: [PATCH 19/43] chore(typescript): release 3.66.5 --- .../fix-sse-protocol-union-test-duplicate-keys.yml | 0 generators/typescript/sdk/versions.yml | 13 +++++++++++++ 2 files changed, 13 insertions(+) rename generators/typescript/sdk/changes/{unreleased => 3.66.5}/fix-sse-protocol-union-test-duplicate-keys.yml (100%) diff --git a/generators/typescript/sdk/changes/unreleased/fix-sse-protocol-union-test-duplicate-keys.yml b/generators/typescript/sdk/changes/3.66.5/fix-sse-protocol-union-test-duplicate-keys.yml similarity index 100% rename from generators/typescript/sdk/changes/unreleased/fix-sse-protocol-union-test-duplicate-keys.yml rename to generators/typescript/sdk/changes/3.66.5/fix-sse-protocol-union-test-duplicate-keys.yml diff --git a/generators/typescript/sdk/versions.yml b/generators/typescript/sdk/versions.yml index c516a0b0fff7..3dda719b0e4f 100644 --- a/generators/typescript/sdk/versions.yml +++ b/generators/typescript/sdk/versions.yml @@ -1,4 +1,17 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 3.66.5 + changelogEntry: + - summary: | + Fix generated wire tests for SSE endpoints with protocol-discriminated unions. + The expected event assertion no longer wraps the deserialized data in a duplicate + discriminant key (which produced TS2783 "specified more than once" errors under + strict typecheck). When the example puts the discriminant inside the data payload + and leaves the SSE event line empty, the discriminant is now promoted onto the + event line before being stripped from the data, so the mocked wire body matches + what the runtime SDK produces. + type: fix + createdAt: "2026-04-29" + irVersion: 66 - version: 3.66.4 changelogEntry: - summary: | From ad435abdf646fa51e8883ea39c3f1c41c4a53f64 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:55:30 -0400 Subject: [PATCH 20/43] chore(python): update python-sdk seed (#15571) Co-authored-by: patrickthornton <70873350+patrickthornton@users.noreply.github.com> --- .../server-sent-event-examples/reference.md | 57 ++++++ .../server-sent-event-examples/snippet.json | 13 ++ .../src/seed/__init__.py | 15 ++ .../src/seed/completions/__init__.py | 15 ++ .../src/seed/completions/client.py | 74 ++++++++ .../src/seed/completions/raw_client.py | 169 ++++++++++++++++++ .../src/seed/completions/types/__init__.py | 17 ++ .../completions/types/group_created_event.py | 20 +++ .../completions/types/group_deleted_event.py | 20 +++ .../stream_event_discriminant_in_data.py | 45 +++++ 10 files changed, 445 insertions(+) create mode 100644 seed/python-sdk/server-sent-event-examples/src/seed/completions/types/group_created_event.py create mode 100644 seed/python-sdk/server-sent-event-examples/src/seed/completions/types/group_deleted_event.py create mode 100644 seed/python-sdk/server-sent-event-examples/src/seed/completions/types/stream_event_discriminant_in_data.py diff --git a/seed/python-sdk/server-sent-event-examples/reference.md b/seed/python-sdk/server-sent-event-examples/reference.md index fafd344ac065..f7d914071fb4 100644 --- a/seed/python-sdk/server-sent-event-examples/reference.md +++ b/seed/python-sdk/server-sent-event-examples/reference.md @@ -110,6 +110,63 @@ client.completions.stream_events( + + + + +
client.completions.stream_events_discriminant_in_data(...) -> typing.Iterator[bytes] +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedServerSentEvents + +client = SeedServerSentEvents( + base_url="https://yourhost.com/path/to/api", +) + +client.completions.stream_events_discriminant_in_data( + query="query", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**query:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
diff --git a/seed/python-sdk/server-sent-event-examples/snippet.json b/seed/python-sdk/server-sent-event-examples/snippet.json index b304b4e3ea18..f58a47363b60 100644 --- a/seed/python-sdk/server-sent-event-examples/snippet.json +++ b/seed/python-sdk/server-sent-event-examples/snippet.json @@ -53,6 +53,19 @@ "type": "python" } }, + { + "example_identifier": "Stream events where discriminant is embedded in data and SSE event line is empty", + "id": { + "path": "/stream-events-discriminant-in-data", + "method": "POST", + "identifier_override": "endpoint_completions.streamEventsDiscriminantInData" + }, + "snippet": { + "sync_client": "from seed import SeedServerSentEvents\n\nclient = SeedServerSentEvents(\n base_url=\"https://yourhost.com/path/to/api\",\n)\nresponse = client.completions.stream_events_discriminant_in_data(\n query=\"query\",\n)\nfor chunk in response.data:\n yield chunk\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedServerSentEvents\n\nclient = AsyncSeedServerSentEvents(\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n response = await client.completions.stream_events_discriminant_in_data(\n query=\"query\",\n )\n async for chunk in response.data:\n yield chunk\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, { "example_identifier": "Stream events context protocol", "id": { diff --git a/seed/python-sdk/server-sent-event-examples/src/seed/__init__.py b/seed/python-sdk/server-sent-event-examples/src/seed/__init__.py index e14584f1a98d..1ec568aff80c 100644 --- a/seed/python-sdk/server-sent-event-examples/src/seed/__init__.py +++ b/seed/python-sdk/server-sent-event-examples/src/seed/__init__.py @@ -14,11 +14,16 @@ CompletionEvent, ErrorEvent, EventEvent, + GroupCreatedEvent, + GroupDeletedEvent, StreamEvent, StreamEventContextProtocol, StreamEventContextProtocol_Completion, StreamEventContextProtocol_Error, StreamEventContextProtocol_Event, + StreamEventDiscriminantInData, + StreamEventDiscriminantInData_GroupCreated, + StreamEventDiscriminantInData_GroupDeleted, StreamEvent_Completion, StreamEvent_Error, StreamedCompletion, @@ -32,12 +37,17 @@ "DefaultAsyncHttpxClient": "._default_clients", "ErrorEvent": ".completions", "EventEvent": ".completions", + "GroupCreatedEvent": ".completions", + "GroupDeletedEvent": ".completions", "SeedServerSentEvents": ".client", "StreamEvent": ".completions", "StreamEventContextProtocol": ".completions", "StreamEventContextProtocol_Completion": ".completions", "StreamEventContextProtocol_Error": ".completions", "StreamEventContextProtocol_Event": ".completions", + "StreamEventDiscriminantInData": ".completions", + "StreamEventDiscriminantInData_GroupCreated": ".completions", + "StreamEventDiscriminantInData_GroupDeleted": ".completions", "StreamEvent_Completion": ".completions", "StreamEvent_Error": ".completions", "StreamedCompletion": ".completions", @@ -75,12 +85,17 @@ def __dir__(): "DefaultAsyncHttpxClient", "ErrorEvent", "EventEvent", + "GroupCreatedEvent", + "GroupDeletedEvent", "SeedServerSentEvents", "StreamEvent", "StreamEventContextProtocol", "StreamEventContextProtocol_Completion", "StreamEventContextProtocol_Error", "StreamEventContextProtocol_Event", + "StreamEventDiscriminantInData", + "StreamEventDiscriminantInData_GroupCreated", + "StreamEventDiscriminantInData_GroupDeleted", "StreamEvent_Completion", "StreamEvent_Error", "StreamedCompletion", diff --git a/seed/python-sdk/server-sent-event-examples/src/seed/completions/__init__.py b/seed/python-sdk/server-sent-event-examples/src/seed/completions/__init__.py index eac81eacc498..264a4c94d942 100644 --- a/seed/python-sdk/server-sent-event-examples/src/seed/completions/__init__.py +++ b/seed/python-sdk/server-sent-event-examples/src/seed/completions/__init__.py @@ -10,11 +10,16 @@ CompletionEvent, ErrorEvent, EventEvent, + GroupCreatedEvent, + GroupDeletedEvent, StreamEvent, StreamEventContextProtocol, StreamEventContextProtocol_Completion, StreamEventContextProtocol_Error, StreamEventContextProtocol_Event, + StreamEventDiscriminantInData, + StreamEventDiscriminantInData_GroupCreated, + StreamEventDiscriminantInData_GroupDeleted, StreamEvent_Completion, StreamEvent_Error, StreamedCompletion, @@ -25,11 +30,16 @@ "CompletionEvent": ".types", "ErrorEvent": ".types", "EventEvent": ".types", + "GroupCreatedEvent": ".types", + "GroupDeletedEvent": ".types", "StreamEvent": ".types", "StreamEventContextProtocol": ".types", "StreamEventContextProtocol_Completion": ".types", "StreamEventContextProtocol_Error": ".types", "StreamEventContextProtocol_Event": ".types", + "StreamEventDiscriminantInData": ".types", + "StreamEventDiscriminantInData_GroupCreated": ".types", + "StreamEventDiscriminantInData_GroupDeleted": ".types", "StreamEvent_Completion": ".types", "StreamEvent_Error": ".types", "StreamedCompletion": ".types", @@ -62,11 +72,16 @@ def __dir__(): "CompletionEvent", "ErrorEvent", "EventEvent", + "GroupCreatedEvent", + "GroupDeletedEvent", "StreamEvent", "StreamEventContextProtocol", "StreamEventContextProtocol_Completion", "StreamEventContextProtocol_Error", "StreamEventContextProtocol_Event", + "StreamEventDiscriminantInData", + "StreamEventDiscriminantInData_GroupCreated", + "StreamEventDiscriminantInData_GroupDeleted", "StreamEvent_Completion", "StreamEvent_Error", "StreamedCompletion", diff --git a/seed/python-sdk/server-sent-event-examples/src/seed/completions/client.py b/seed/python-sdk/server-sent-event-examples/src/seed/completions/client.py index c509ffc39f0e..a0cd6578721a 100644 --- a/seed/python-sdk/server-sent-event-examples/src/seed/completions/client.py +++ b/seed/python-sdk/server-sent-event-examples/src/seed/completions/client.py @@ -7,6 +7,7 @@ from .raw_client import AsyncRawCompletionsClient, RawCompletionsClient from .types.stream_event import StreamEvent from .types.stream_event_context_protocol import StreamEventContextProtocol +from .types.stream_event_discriminant_in_data import StreamEventDiscriminantInData from .types.streamed_completion import StreamedCompletion # this is used as the default value for optional parameters @@ -90,6 +91,37 @@ def stream_events( with self._raw_client.stream_events(query=query, request_options=request_options) as r: yield from r.data + def stream_events_discriminant_in_data( + self, *, query: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[StreamEventDiscriminantInData]: + """ + Parameters + ---------- + query : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.Iterator[StreamEventDiscriminantInData] + + Examples + -------- + from seed import SeedServerSentEvents + + client = SeedServerSentEvents( + base_url="https://yourhost.com/path/to/api", + ) + response = client.completions.stream_events_discriminant_in_data( + query="query", + ) + for chunk in response: + yield chunk + """ + with self._raw_client.stream_events_discriminant_in_data(query=query, request_options=request_options) as r: + yield from r.data + def stream_events_context_protocol( self, *, query: str, request_options: typing.Optional[RequestOptions] = None ) -> typing.Iterator[StreamEventContextProtocol]: @@ -217,6 +249,48 @@ async def main() -> None: async for _chunk in r.data: yield _chunk + async def stream_events_discriminant_in_data( + self, *, query: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[StreamEventDiscriminantInData]: + """ + Parameters + ---------- + query : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.AsyncIterator[StreamEventDiscriminantInData] + + Examples + -------- + import asyncio + + from seed import AsyncSeedServerSentEvents + + client = AsyncSeedServerSentEvents( + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + response = await client.completions.stream_events_discriminant_in_data( + query="query", + ) + async for chunk in response: + yield chunk + + + asyncio.run(main()) + """ + async with self._raw_client.stream_events_discriminant_in_data( + query=query, request_options=request_options + ) as r: + async for _chunk in r.data: + yield _chunk + async def stream_events_context_protocol( self, *, query: str, request_options: typing.Optional[RequestOptions] = None ) -> typing.AsyncIterator[StreamEventContextProtocol]: diff --git a/seed/python-sdk/server-sent-event-examples/src/seed/completions/raw_client.py b/seed/python-sdk/server-sent-event-examples/src/seed/completions/raw_client.py index 985a9fb282a9..6c5fb131f460 100644 --- a/seed/python-sdk/server-sent-event-examples/src/seed/completions/raw_client.py +++ b/seed/python-sdk/server-sent-event-examples/src/seed/completions/raw_client.py @@ -15,6 +15,7 @@ from .errors.bad_request_error import BadRequestError from .types.stream_event import StreamEvent from .types.stream_event_context_protocol import StreamEventContextProtocol +from .types.stream_event_discriminant_in_data import StreamEventDiscriminantInData from .types.streamed_completion import StreamedCompletion from pydantic import ValidationError @@ -194,6 +195,90 @@ def _iter(): yield _stream() + @contextlib.contextmanager + def stream_events_discriminant_in_data( + self, *, query: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[HttpResponse[typing.Iterator[StreamEventDiscriminantInData]]]: + """ + Parameters + ---------- + query : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.Iterator[HttpResponse[typing.Iterator[StreamEventDiscriminantInData]]] + """ + with self._client_wrapper.httpx_client.stream( + "stream-events-discriminant-in-data", + method="POST", + json={ + "query": query, + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[StreamEventDiscriminantInData]]: + try: + if 200 <= _response.status_code < 300: + + def _iter(): + _event_source = EventSource(_response) + for _sse in _event_source.iter_sse(): + if _sse.data == None: + return + try: + yield typing.cast( + StreamEventDiscriminantInData, + parse_sse_obj( + sse=_sse, + type_=StreamEventDiscriminantInData, # type: ignore + ), + ) + except JSONDecodeError as e: + warning(f"Skipping SSE event with invalid JSON: {e}, sse: {_sse!r}") + except (TypeError, ValueError, KeyError, AttributeError) as e: + warning( + f"Skipping SSE event due to model construction error: {type(e).__name__}: {e}, sse: {_sse!r}" + ) + except Exception as e: + error( + f"Unexpected error processing SSE event: {type(e).__name__}: {e}, sse: {_sse!r}" + ) + return + + return HttpResponse(response=_response, data=_iter()) + _response.read() + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + str, + parse_obj_as( + type_=str, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + @contextlib.contextmanager def stream_events_context_protocol( self, *, query: str, request_options: typing.Optional[RequestOptions] = None @@ -451,6 +536,90 @@ async def _iter(): yield await _stream() + @contextlib.asynccontextmanager + async def stream_events_discriminant_in_data( + self, *, query: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[StreamEventDiscriminantInData]]]: + """ + Parameters + ---------- + query : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[StreamEventDiscriminantInData]]] + """ + async with self._client_wrapper.httpx_client.stream( + "stream-events-discriminant-in-data", + method="POST", + json={ + "query": query, + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[StreamEventDiscriminantInData]]: + try: + if 200 <= _response.status_code < 300: + + async def _iter(): + _event_source = EventSource(_response) + async for _sse in _event_source.aiter_sse(): + if _sse.data == None: + return + try: + yield typing.cast( + StreamEventDiscriminantInData, + parse_sse_obj( + sse=_sse, + type_=StreamEventDiscriminantInData, # type: ignore + ), + ) + except JSONDecodeError as e: + warning(f"Skipping SSE event with invalid JSON: {e}, sse: {_sse!r}") + except (TypeError, ValueError, KeyError, AttributeError) as e: + warning( + f"Skipping SSE event due to model construction error: {type(e).__name__}: {e}, sse: {_sse!r}" + ) + except Exception as e: + error( + f"Unexpected error processing SSE event: {type(e).__name__}: {e}, sse: {_sse!r}" + ) + return + + return AsyncHttpResponse(response=_response, data=_iter()) + await _response.aread() + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + str, + parse_obj_as( + type_=str, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + @contextlib.asynccontextmanager async def stream_events_context_protocol( self, *, query: str, request_options: typing.Optional[RequestOptions] = None diff --git a/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/__init__.py b/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/__init__.py index 0d293f705ab9..7be0135a4737 100644 --- a/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/__init__.py +++ b/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/__init__.py @@ -9,6 +9,8 @@ from .completion_event import CompletionEvent from .error_event import ErrorEvent from .event_event import EventEvent + from .group_created_event import GroupCreatedEvent + from .group_deleted_event import GroupDeletedEvent from .stream_event import StreamEvent, StreamEvent_Completion, StreamEvent_Error from .stream_event_context_protocol import ( StreamEventContextProtocol, @@ -16,16 +18,26 @@ StreamEventContextProtocol_Error, StreamEventContextProtocol_Event, ) + from .stream_event_discriminant_in_data import ( + StreamEventDiscriminantInData, + StreamEventDiscriminantInData_GroupCreated, + StreamEventDiscriminantInData_GroupDeleted, + ) from .streamed_completion import StreamedCompletion _dynamic_imports: typing.Dict[str, str] = { "CompletionEvent": ".completion_event", "ErrorEvent": ".error_event", "EventEvent": ".event_event", + "GroupCreatedEvent": ".group_created_event", + "GroupDeletedEvent": ".group_deleted_event", "StreamEvent": ".stream_event", "StreamEventContextProtocol": ".stream_event_context_protocol", "StreamEventContextProtocol_Completion": ".stream_event_context_protocol", "StreamEventContextProtocol_Error": ".stream_event_context_protocol", "StreamEventContextProtocol_Event": ".stream_event_context_protocol", + "StreamEventDiscriminantInData": ".stream_event_discriminant_in_data", + "StreamEventDiscriminantInData_GroupCreated": ".stream_event_discriminant_in_data", + "StreamEventDiscriminantInData_GroupDeleted": ".stream_event_discriminant_in_data", "StreamEvent_Completion": ".stream_event", "StreamEvent_Error": ".stream_event", "StreamedCompletion": ".streamed_completion", @@ -57,11 +69,16 @@ def __dir__(): "CompletionEvent", "ErrorEvent", "EventEvent", + "GroupCreatedEvent", + "GroupDeletedEvent", "StreamEvent", "StreamEventContextProtocol", "StreamEventContextProtocol_Completion", "StreamEventContextProtocol_Error", "StreamEventContextProtocol_Event", + "StreamEventDiscriminantInData", + "StreamEventDiscriminantInData_GroupCreated", + "StreamEventDiscriminantInData_GroupDeleted", "StreamEvent_Completion", "StreamEvent_Error", "StreamedCompletion", diff --git a/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/group_created_event.py b/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/group_created_event.py new file mode 100644 index 000000000000..cdb3b8cb02f0 --- /dev/null +++ b/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/group_created_event.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class GroupCreatedEvent(UniversalBaseModel): + offset: str + group_id: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/group_deleted_event.py b/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/group_deleted_event.py new file mode 100644 index 000000000000..9bbeb755d1d1 --- /dev/null +++ b/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/group_deleted_event.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class GroupDeletedEvent(UniversalBaseModel): + offset: str + group_id: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/stream_event_discriminant_in_data.py b/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/stream_event_discriminant_in_data.py new file mode 100644 index 000000000000..5837897e2bc5 --- /dev/null +++ b/seed/python-sdk/server-sent-event-examples/src/seed/completions/types/stream_event_discriminant_in_data.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class StreamEventDiscriminantInData_GroupCreated(UniversalBaseModel): + type: typing.Literal["group.created"] = "group.created" + offset: str + group_id: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class StreamEventDiscriminantInData_GroupDeleted(UniversalBaseModel): + type: typing.Literal["group.deleted"] = "group.deleted" + offset: str + group_id: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +StreamEventDiscriminantInData = typing_extensions.Annotated[ + typing.Union[StreamEventDiscriminantInData_GroupCreated, StreamEventDiscriminantInData_GroupDeleted], + pydantic.Field(discriminator="type"), +] From 0428a39c3c0f76177548992d1dfa61a0e0cba9d4 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:55:57 -0400 Subject: [PATCH 21/43] chore(php): update php-sdk seed (#15570) Co-authored-by: patrickthornton <70873350+patrickthornton@users.noreply.github.com> --- .../server-sent-event-examples/reference.md | 44 ++++ .../src/Completions/CompletionsClient.php | 38 ++++ .../StreamEventsDiscriminantInDataRequest.php | 26 +++ .../Completions/Types/GroupCreatedEvent.php | 42 ++++ .../Completions/Types/GroupDeletedEvent.php | 42 ++++ .../Types/StreamEventDiscriminantInData.php | 209 ++++++++++++++++++ .../dynamic-snippets/example10/snippet.php | 6 +- .../dynamic-snippets/example12/snippet.php | 17 ++ .../dynamic-snippets/example13/snippet.php | 17 ++ .../dynamic-snippets/example14/snippet.php | 17 ++ .../src/dynamic-snippets/example8/snippet.php | 6 +- .../src/dynamic-snippets/example9/snippet.php | 8 +- 12 files changed, 462 insertions(+), 10 deletions(-) create mode 100644 seed/php-sdk/server-sent-event-examples/src/Completions/Requests/StreamEventsDiscriminantInDataRequest.php create mode 100644 seed/php-sdk/server-sent-event-examples/src/Completions/Types/GroupCreatedEvent.php create mode 100644 seed/php-sdk/server-sent-event-examples/src/Completions/Types/GroupDeletedEvent.php create mode 100644 seed/php-sdk/server-sent-event-examples/src/Completions/Types/StreamEventDiscriminantInData.php create mode 100644 seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example12/snippet.php create mode 100644 seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example13/snippet.php create mode 100644 seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example14/snippet.php diff --git a/seed/php-sdk/server-sent-event-examples/reference.md b/seed/php-sdk/server-sent-event-examples/reference.md index aa79398c9fd8..e6df8754ee51 100644 --- a/seed/php-sdk/server-sent-event-examples/reference.md +++ b/seed/php-sdk/server-sent-event-examples/reference.md @@ -84,6 +84,50 @@ $client->completions->streamEvents( + + + + +
$client->completions->streamEventsDiscriminantInData($request) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```php +$client->completions->streamEventsDiscriminantInData( + new StreamEventsDiscriminantInDataRequest([ + 'query' => 'query', + ]), +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**$query:** `string` + +
+
+
+
+ +
diff --git a/seed/php-sdk/server-sent-event-examples/src/Completions/CompletionsClient.php b/seed/php-sdk/server-sent-event-examples/src/Completions/CompletionsClient.php index 3064ca9edb41..d5e928e63184 100644 --- a/seed/php-sdk/server-sent-event-examples/src/Completions/CompletionsClient.php +++ b/seed/php-sdk/server-sent-event-examples/src/Completions/CompletionsClient.php @@ -11,6 +11,7 @@ use Seed\Core\Client\HttpMethod; use Psr\Http\Client\ClientExceptionInterface; use Seed\Completions\Requests\StreamEventsRequest; +use Seed\Completions\Requests\StreamEventsDiscriminantInDataRequest; use Seed\Completions\Requests\StreamEventsContextProtocolRequest; class CompletionsClient @@ -123,6 +124,43 @@ public function streamEvents(StreamEventsRequest $request, ?array $options = nul ); } + /** + * @param StreamEventsDiscriminantInDataRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @throws SeedException + * @throws SeedApiException + */ + public function streamEventsDiscriminantInData(StreamEventsDiscriminantInDataRequest $request, ?array $options = null): void + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? '', + path: "stream-events-discriminant-in-data", + method: HttpMethod::POST, + body: $request, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + } catch (ClientExceptionInterface $e) { + throw new SeedException(message: $e->getMessage(), previous: $e); + } + throw new SeedApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + /** * @param StreamEventsContextProtocolRequest $request * @param ?array{ diff --git a/seed/php-sdk/server-sent-event-examples/src/Completions/Requests/StreamEventsDiscriminantInDataRequest.php b/seed/php-sdk/server-sent-event-examples/src/Completions/Requests/StreamEventsDiscriminantInDataRequest.php new file mode 100644 index 000000000000..5f6ae8b56ccb --- /dev/null +++ b/seed/php-sdk/server-sent-event-examples/src/Completions/Requests/StreamEventsDiscriminantInDataRequest.php @@ -0,0 +1,26 @@ +query = $values['query']; + } +} diff --git a/seed/php-sdk/server-sent-event-examples/src/Completions/Types/GroupCreatedEvent.php b/seed/php-sdk/server-sent-event-examples/src/Completions/Types/GroupCreatedEvent.php new file mode 100644 index 000000000000..7f533f064934 --- /dev/null +++ b/seed/php-sdk/server-sent-event-examples/src/Completions/Types/GroupCreatedEvent.php @@ -0,0 +1,42 @@ +offset = $values['offset']; + $this->groupId = $values['groupId']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/seed/php-sdk/server-sent-event-examples/src/Completions/Types/GroupDeletedEvent.php b/seed/php-sdk/server-sent-event-examples/src/Completions/Types/GroupDeletedEvent.php new file mode 100644 index 000000000000..7a6e12b3878f --- /dev/null +++ b/seed/php-sdk/server-sent-event-examples/src/Completions/Types/GroupDeletedEvent.php @@ -0,0 +1,42 @@ +offset = $values['offset']; + $this->groupId = $values['groupId']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/seed/php-sdk/server-sent-event-examples/src/Completions/Types/StreamEventDiscriminantInData.php b/seed/php-sdk/server-sent-event-examples/src/Completions/Types/StreamEventDiscriminantInData.php new file mode 100644 index 000000000000..040dc56940a1 --- /dev/null +++ b/seed/php-sdk/server-sent-event-examples/src/Completions/Types/StreamEventDiscriminantInData.php @@ -0,0 +1,209 @@ +type = $values['type']; + $this->value = $values['value']; + } + + /** + * @param GroupCreatedEvent $groupCreated + * @return StreamEventDiscriminantInData + */ + public static function groupCreated(GroupCreatedEvent $groupCreated): StreamEventDiscriminantInData + { + return new StreamEventDiscriminantInData([ + 'type' => 'group.created', + 'value' => $groupCreated, + ]); + } + + /** + * @param GroupDeletedEvent $groupDeleted + * @return StreamEventDiscriminantInData + */ + public static function groupDeleted(GroupDeletedEvent $groupDeleted): StreamEventDiscriminantInData + { + return new StreamEventDiscriminantInData([ + 'type' => 'group.deleted', + 'value' => $groupDeleted, + ]); + } + + /** + * @return bool + */ + public function isGroupCreated(): bool + { + return $this->value instanceof GroupCreatedEvent && $this->type === 'group.created'; + } + + /** + * @return GroupCreatedEvent + */ + public function asGroupCreated(): GroupCreatedEvent + { + if (!($this->value instanceof GroupCreatedEvent && $this->type === 'group.created')) { + throw new Exception( + "Expected group.created; got " . $this->type . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + + /** + * @return bool + */ + public function isGroupDeleted(): bool + { + return $this->value instanceof GroupDeletedEvent && $this->type === 'group.deleted'; + } + + /** + * @return GroupDeletedEvent + */ + public function asGroupDeleted(): GroupDeletedEvent + { + if (!($this->value instanceof GroupDeletedEvent && $this->type === 'group.deleted')) { + throw new Exception( + "Expected group.deleted; got " . $this->type . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } + + /** + * @return array + */ + public function jsonSerialize(): array + { + $result = []; + $result['type'] = $this->type; + + $base = parent::jsonSerialize(); + $result = array_merge($base, $result); + + switch ($this->type) { + case 'group.created': + $value = $this->asGroupCreated()->jsonSerialize(); + $result = array_merge($value, $result); + break; + case 'group.deleted': + $value = $this->asGroupDeleted()->jsonSerialize(); + $result = array_merge($value, $result); + break; + case '_unknown': + default: + if (is_null($this->value)) { + break; + } + if ($this->value instanceof JsonSerializableType) { + $value = $this->value->jsonSerialize(); + $result = array_merge($value, $result); + } elseif (is_array($this->value)) { + $result = array_merge($this->value, $result); + } + } + + return $result; + } + + /** + * @param string $json + */ + public static function fromJson(string $json): static + { + $decodedJson = JsonDecoder::decode($json); + if (!is_array($decodedJson)) { + throw new Exception("Unexpected non-array decoded type: " . gettype($decodedJson)); + } + return self::jsonDeserialize($decodedJson); + } + + /** + * @param array $data + */ + public static function jsonDeserialize(array $data): static + { + $args = []; + if (!array_key_exists('type', $data)) { + throw new Exception( + "JSON data is missing property 'type'", + ); + } + $type = $data['type']; + if (!(is_string($type))) { + throw new Exception( + "Expected property 'type' in JSON data to be string, instead received " . get_debug_type($data['type']), + ); + } + + $args['type'] = $type; + switch ($type) { + case 'group.created': + $args['value'] = GroupCreatedEvent::jsonDeserialize($data); + break; + case 'group.deleted': + $args['value'] = GroupDeletedEvent::jsonDeserialize($data); + break; + case '_unknown': + default: + $args['type'] = '_unknown'; + $args['value'] = $data; + } + + // @phpstan-ignore-next-line + return new static($args); + } +} diff --git a/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example10/snippet.php b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example10/snippet.php index 300ea7b92c3e..48b0417d942e 100644 --- a/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example10/snippet.php +++ b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example10/snippet.php @@ -3,15 +3,15 @@ namespace Example; use Seed\SeedClient; -use Seed\Completions\Requests\StreamEventsContextProtocolRequest; +use Seed\Completions\Requests\StreamEventsDiscriminantInDataRequest; $client = new SeedClient( options: [ 'baseUrl' => 'https://api.fern.com', ], ); -$client->completions->streamEventsContextProtocol( - new StreamEventsContextProtocolRequest([ +$client->completions->streamEventsDiscriminantInData( + new StreamEventsDiscriminantInDataRequest([ 'query' => 'query', ]), ); diff --git a/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example12/snippet.php b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example12/snippet.php new file mode 100644 index 000000000000..78a273973d2a --- /dev/null +++ b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example12/snippet.php @@ -0,0 +1,17 @@ + 'https://api.fern.com', + ], +); +$client->completions->streamEventsContextProtocol( + new StreamEventsContextProtocolRequest([ + 'query' => '', + ]), +); diff --git a/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example13/snippet.php b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example13/snippet.php new file mode 100644 index 000000000000..300ea7b92c3e --- /dev/null +++ b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example13/snippet.php @@ -0,0 +1,17 @@ + 'https://api.fern.com', + ], +); +$client->completions->streamEventsContextProtocol( + new StreamEventsContextProtocolRequest([ + 'query' => 'query', + ]), +); diff --git a/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example14/snippet.php b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example14/snippet.php new file mode 100644 index 000000000000..300ea7b92c3e --- /dev/null +++ b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example14/snippet.php @@ -0,0 +1,17 @@ + 'https://api.fern.com', + ], +); +$client->completions->streamEventsContextProtocol( + new StreamEventsContextProtocolRequest([ + 'query' => 'query', + ]), +); diff --git a/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example8/snippet.php b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example8/snippet.php index 300ea7b92c3e..48b0417d942e 100644 --- a/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example8/snippet.php +++ b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example8/snippet.php @@ -3,15 +3,15 @@ namespace Example; use Seed\SeedClient; -use Seed\Completions\Requests\StreamEventsContextProtocolRequest; +use Seed\Completions\Requests\StreamEventsDiscriminantInDataRequest; $client = new SeedClient( options: [ 'baseUrl' => 'https://api.fern.com', ], ); -$client->completions->streamEventsContextProtocol( - new StreamEventsContextProtocolRequest([ +$client->completions->streamEventsDiscriminantInData( + new StreamEventsDiscriminantInDataRequest([ 'query' => 'query', ]), ); diff --git a/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example9/snippet.php b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example9/snippet.php index 78a273973d2a..48b0417d942e 100644 --- a/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example9/snippet.php +++ b/seed/php-sdk/server-sent-event-examples/src/dynamic-snippets/example9/snippet.php @@ -3,15 +3,15 @@ namespace Example; use Seed\SeedClient; -use Seed\Completions\Requests\StreamEventsContextProtocolRequest; +use Seed\Completions\Requests\StreamEventsDiscriminantInDataRequest; $client = new SeedClient( options: [ 'baseUrl' => 'https://api.fern.com', ], ); -$client->completions->streamEventsContextProtocol( - new StreamEventsContextProtocolRequest([ - 'query' => '', +$client->completions->streamEventsDiscriminantInData( + new StreamEventsDiscriminantInDataRequest([ + 'query' => 'query', ]), ); From 16332cff90a7132b94fadd7a4da676bc9559829b Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:56:21 -0400 Subject: [PATCH 22/43] chore(typescript): update ts-sdk seed (#15574) Co-authored-by: patrickthornton <70873350+patrickthornton@users.noreply.github.com> --- .../.fern/metadata.json | 3 ++- .../no-custom-config/tests/wire/main.test.ts | 23 ++++++------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/seed/ts-sdk/server-sent-event-examples/.fern/metadata.json b/seed/ts-sdk/server-sent-event-examples/.fern/metadata.json index 9ea68298004b..5789995ae525 100644 --- a/seed/ts-sdk/server-sent-event-examples/.fern/metadata.json +++ b/seed/ts-sdk/server-sent-event-examples/.fern/metadata.json @@ -3,7 +3,8 @@ "generatorName": "fernapi/fern-typescript-sdk", "generatorVersion": "local", "originGitCommit": "DUMMY", - "invokedBy": "manual", + "invokedBy": "ci", "requestedVersion": "0.0.1", + "ciProvider": "github", "sdkVersion": "0.0.1" } diff --git a/seed/ts-sdk/server-sent-events-openapi/no-custom-config/tests/wire/main.test.ts b/seed/ts-sdk/server-sent-events-openapi/no-custom-config/tests/wire/main.test.ts index c0ea709e01e5..12616b3718cd 100644 --- a/seed/ts-sdk/server-sent-events-openapi/no-custom-config/tests/wire/main.test.ts +++ b/seed/ts-sdk/server-sent-events-openapi/no-custom-config/tests/wire/main.test.ts @@ -8,7 +8,7 @@ describe("SeedApiClient", () => { const server = mockServerPool.createServer(); const client = new SeedApiClient({ maxRetries: 0, environment: server.baseUrl }); const rawRequestBody = {}; - const rawResponseBody = "event: \ndata: {}\n\n"; + const rawResponseBody = "event: heartbeat\ndata: {}\n\n"; server .mockEndpoint() @@ -26,10 +26,7 @@ describe("SeedApiClient", () => { } expect(events).toEqual([ { - event: "", - ...{ - event: "heartbeat", - }, + event: "heartbeat", }, ]); }); @@ -38,7 +35,7 @@ describe("SeedApiClient", () => { const server = mockServerPool.createServer(); const client = new SeedApiClient({ maxRetries: 0, environment: server.baseUrl }); const rawRequestBody = {}; - const rawResponseBody = "event: \ndata: {}\n\n"; + const rawResponseBody = "event: heartbeat\ndata: {}\n\n"; server .mockEndpoint() @@ -56,10 +53,7 @@ describe("SeedApiClient", () => { } expect(events).toEqual([ { - event: "", - ...{ - event: "heartbeat", - }, + event: "heartbeat", }, ]); }); @@ -124,7 +118,7 @@ describe("SeedApiClient", () => { const server = mockServerPool.createServer(); const client = new SeedApiClient({ maxRetries: 0, environment: server.baseUrl }); const rawRequestBody = {}; - const rawResponseBody = 'event: \ndata: {"timestamp":"2024-01-15T09:30:00Z"}\n\n'; + const rawResponseBody = 'event: heartbeat\ndata: {"timestamp":"2024-01-15T09:30:00Z"}\n\n'; server .mockEndpoint() @@ -142,11 +136,8 @@ describe("SeedApiClient", () => { } expect(events).toEqual([ { - event: "", - ...{ - event: "heartbeat", - timestamp: "2024-01-15T09:30:00Z", - }, + event: "heartbeat", + timestamp: "2024-01-15T09:30:00Z", }, ]); }); From 00ed79f326f14be3319f9d56bb52d98677a36670 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:56:23 -0400 Subject: [PATCH 23/43] chore(java): update java-sdk seed (#15576) Co-authored-by: patrickthornton <70873350+patrickthornton@users.noreply.github.com> --- .../no-custom-config/reference.md | 45 ++++ .../no-custom-config/snippet.json | 39 +++ .../completions/AsyncCompletionsClient.java | 14 ++ .../AsyncRawCompletionsClient.java | 78 ++++++ .../completions/CompletionsClient.java | 14 ++ .../completions/RawCompletionsClient.java | 60 +++++ ...StreamEventsDiscriminantInDataRequest.java | 119 ++++++++++ .../completions/types/GroupCreatedEvent.java | 140 +++++++++++ .../completions/types/GroupDeletedEvent.java | 140 +++++++++++ .../types/StreamEventDiscriminantInData.java | 222 ++++++++++++++++++ .../src/main/java/com/snippets/Example10.java | 4 +- .../src/main/java/com/snippets/Example12.java | 15 ++ .../src/main/java/com/snippets/Example13.java | 16 ++ .../src/main/java/com/snippets/Example14.java | 16 ++ .../src/main/java/com/snippets/Example8.java | 4 +- .../src/main/java/com/snippets/Example9.java | 7 +- .../with-wire-tests/reference.md | 45 ++++ .../with-wire-tests/snippet.json | 39 +++ .../completions/AsyncCompletionsClient.java | 14 ++ .../AsyncRawCompletionsClient.java | 78 ++++++ .../completions/CompletionsClient.java | 14 ++ .../completions/RawCompletionsClient.java | 60 +++++ ...StreamEventsDiscriminantInDataRequest.java | 119 ++++++++++ .../completions/types/GroupCreatedEvent.java | 140 +++++++++++ .../completions/types/GroupDeletedEvent.java | 140 +++++++++++ .../types/StreamEventDiscriminantInData.java | 222 ++++++++++++++++++ .../src/main/java/com/snippets/Example10.java | 4 +- .../src/main/java/com/snippets/Example12.java | 15 ++ .../src/main/java/com/snippets/Example13.java | 16 ++ .../src/main/java/com/snippets/Example14.java | 16 ++ .../src/main/java/com/snippets/Example8.java | 4 +- .../src/main/java/com/snippets/Example9.java | 7 +- .../serverSentEvents/CompletionsWireTest.java | 50 ++++ 33 files changed, 1902 insertions(+), 14 deletions(-) create mode 100644 seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/requests/StreamEventsDiscriminantInDataRequest.java create mode 100644 seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupCreatedEvent.java create mode 100644 seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupDeletedEvent.java create mode 100644 seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/StreamEventDiscriminantInData.java create mode 100644 seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example12.java create mode 100644 seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example13.java create mode 100644 seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example14.java create mode 100644 seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/requests/StreamEventsDiscriminantInDataRequest.java create mode 100644 seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupCreatedEvent.java create mode 100644 seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupDeletedEvent.java create mode 100644 seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/StreamEventDiscriminantInData.java create mode 100644 seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example12.java create mode 100644 seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example13.java create mode 100644 seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example14.java diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/reference.md b/seed/java-sdk/server-sent-event-examples/no-custom-config/reference.md index 4849fdc07976..357c6e72480e 100644 --- a/seed/java-sdk/server-sent-event-examples/no-custom-config/reference.md +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/reference.md @@ -86,6 +86,51 @@ client.completions().streamEvents( + + + + +
client.completions.streamEventsDiscriminantInData(request) -> Iterable&lt;StreamEventDiscriminantInData&gt; +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.completions().streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest + .builder() + .query("query") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**query:** `String` + +
+
+
+
+ +
diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/snippet.json b/seed/java-sdk/server-sent-event-examples/no-custom-config/snippet.json index 585bd83a3910..7abef6bb03ab 100644 --- a/seed/java-sdk/server-sent-event-examples/no-custom-config/snippet.json +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/snippet.json @@ -104,6 +104,45 @@ "async_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEvents(\n StreamEventsRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n" } }, + { + "example_identifier": "Stream events where discriminant is embedded in data and SSE event line is empty", + "id": { + "method": "POST", + "path": "/stream-events-discriminant-in-data", + "identifier_override": "endpoint_completions.streamEventsDiscriminantInData" + }, + "snippet": { + "type": "java", + "sync_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n", + "async_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n" + } + }, + { + "example_identifier": "43ddff75", + "id": { + "method": "POST", + "path": "/stream-events-discriminant-in-data", + "identifier_override": "endpoint_completions.streamEventsDiscriminantInData" + }, + "snippet": { + "type": "java", + "sync_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n", + "async_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n" + } + }, + { + "example_identifier": "95b7c867", + "id": { + "method": "POST", + "path": "/stream-events-discriminant-in-data", + "identifier_override": "endpoint_completions.streamEventsDiscriminantInData" + }, + "snippet": { + "type": "java", + "sync_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n", + "async_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n" + } + }, { "example_identifier": "Stream events context protocol", "id": { diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncCompletionsClient.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncCompletionsClient.java index b31cf3e907ce..cf63ae18a794 100644 --- a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncCompletionsClient.java +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncCompletionsClient.java @@ -7,9 +7,11 @@ import com.seed.serverSentEvents.core.RequestOptions; import com.seed.serverSentEvents.resources.completions.requests.StreamCompletionRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsRequest; import com.seed.serverSentEvents.resources.completions.types.StreamEvent; import com.seed.serverSentEvents.resources.completions.types.StreamEventContextProtocol; +import com.seed.serverSentEvents.resources.completions.types.StreamEventDiscriminantInData; import com.seed.serverSentEvents.resources.completions.types.StreamedCompletion; import java.util.concurrent.CompletableFuture; @@ -48,6 +50,18 @@ public CompletableFuture> streamEvents( return this.rawClient.streamEvents(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture> streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request) { + return this.rawClient.streamEventsDiscriminantInData(request).thenApply(response -> response.body()); + } + + public CompletableFuture> streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request, RequestOptions requestOptions) { + return this.rawClient + .streamEventsDiscriminantInData(request, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture> streamEventsContextProtocol( StreamEventsContextProtocolRequest request) { return this.rawClient.streamEventsContextProtocol(request).thenApply(response -> response.body()); diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncRawCompletionsClient.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncRawCompletionsClient.java index 635c3e973f83..d33a0c2a9357 100644 --- a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncRawCompletionsClient.java +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncRawCompletionsClient.java @@ -16,9 +16,11 @@ import com.seed.serverSentEvents.resources.completions.errors.BadRequestError; import com.seed.serverSentEvents.resources.completions.requests.StreamCompletionRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsRequest; import com.seed.serverSentEvents.resources.completions.types.StreamEvent; import com.seed.serverSentEvents.resources.completions.types.StreamEventContextProtocol; +import com.seed.serverSentEvents.resources.completions.types.StreamEventDiscriminantInData; import com.seed.serverSentEvents.resources.completions.types.StreamedCompletion; import java.io.IOException; import java.util.concurrent.CompletableFuture; @@ -191,6 +193,82 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture>> + streamEventsDiscriminantInData(StreamEventsDiscriminantInDataRequest request) { + return streamEventsDiscriminantInData(request, null); + } + + public CompletableFuture>> + streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stream-events-discriminant-in-data"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new SeedServerSentEventsException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + client = client.newBuilder().callTimeout(0, TimeUnit.SECONDS).build(); + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + future.complete(new SeedServerSentEventsHttpResponse<>( + Stream.fromSse(StreamEventDiscriminantInData.class, new ResponseBodyReader(response)), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, String.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new SeedServerSentEventsApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally( + new SeedServerSentEventsException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally( + new SeedServerSentEventsException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture>> streamEventsContextProtocol(StreamEventsContextProtocolRequest request) { return streamEventsContextProtocol(request, null); diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/CompletionsClient.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/CompletionsClient.java index 350f9115c371..cfc439193fa5 100644 --- a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/CompletionsClient.java +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/CompletionsClient.java @@ -7,9 +7,11 @@ import com.seed.serverSentEvents.core.RequestOptions; import com.seed.serverSentEvents.resources.completions.requests.StreamCompletionRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsRequest; import com.seed.serverSentEvents.resources.completions.types.StreamEvent; import com.seed.serverSentEvents.resources.completions.types.StreamEventContextProtocol; +import com.seed.serverSentEvents.resources.completions.types.StreamEventDiscriminantInData; import com.seed.serverSentEvents.resources.completions.types.StreamedCompletion; public class CompletionsClient { @@ -45,6 +47,18 @@ public Iterable streamEvents(StreamEventsRequest request, RequestOp return this.rawClient.streamEvents(request, requestOptions).body(); } + public Iterable streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request) { + return this.rawClient.streamEventsDiscriminantInData(request).body(); + } + + public Iterable streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request, RequestOptions requestOptions) { + return this.rawClient + .streamEventsDiscriminantInData(request, requestOptions) + .body(); + } + public Iterable streamEventsContextProtocol( StreamEventsContextProtocolRequest request) { return this.rawClient.streamEventsContextProtocol(request).body(); diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/RawCompletionsClient.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/RawCompletionsClient.java index 346521478802..1621730b2d40 100644 --- a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/RawCompletionsClient.java +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/RawCompletionsClient.java @@ -16,9 +16,11 @@ import com.seed.serverSentEvents.resources.completions.errors.BadRequestError; import com.seed.serverSentEvents.resources.completions.requests.StreamCompletionRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsRequest; import com.seed.serverSentEvents.resources.completions.types.StreamEvent; import com.seed.serverSentEvents.resources.completions.types.StreamEventContextProtocol; +import com.seed.serverSentEvents.resources.completions.types.StreamEventDiscriminantInData; import com.seed.serverSentEvents.resources.completions.types.StreamedCompletion; import java.io.IOException; import java.util.concurrent.TimeUnit; @@ -152,6 +154,64 @@ StreamEvent.class, new ResponseBodyReader(response), "event", "[DONE]"), } } + public SeedServerSentEventsHttpResponse> streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request) { + return streamEventsDiscriminantInData(request, null); + } + + public SeedServerSentEventsHttpResponse> streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stream-events-discriminant-in-data"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new SeedServerSentEventsException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + client = client.newBuilder().callTimeout(0, TimeUnit.SECONDS).build(); + try { + Response response = client.newCall(okhttpRequest).execute(); + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new SeedServerSentEventsHttpResponse<>( + Stream.fromSse(StreamEventDiscriminantInData.class, new ResponseBodyReader(response)), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, String.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new SeedServerSentEventsApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new SeedServerSentEventsException("Network error executing HTTP request", e); + } + } + public SeedServerSentEventsHttpResponse> streamEventsContextProtocol( StreamEventsContextProtocolRequest request) { return streamEventsContextProtocol(request, null); diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/requests/StreamEventsDiscriminantInDataRequest.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/requests/StreamEventsDiscriminantInDataRequest.java new file mode 100644 index 000000000000..8a3fab308e22 --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/requests/StreamEventsDiscriminantInDataRequest.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.serverSentEvents.resources.completions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.serverSentEvents.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StreamEventsDiscriminantInDataRequest.Builder.class) +public final class StreamEventsDiscriminantInDataRequest { + private final String query; + + private final Map additionalProperties; + + private StreamEventsDiscriminantInDataRequest(String query, Map additionalProperties) { + this.query = query; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("query") + public String getQuery() { + return query; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StreamEventsDiscriminantInDataRequest + && equalTo((StreamEventsDiscriminantInDataRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(StreamEventsDiscriminantInDataRequest other) { + return query.equals(other.query); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.query); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static QueryStage builder() { + return new Builder(); + } + + public interface QueryStage { + _FinalStage query(@NotNull String query); + + Builder from(StreamEventsDiscriminantInDataRequest other); + } + + public interface _FinalStage { + StreamEventsDiscriminantInDataRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements QueryStage, _FinalStage { + private String query; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(StreamEventsDiscriminantInDataRequest other) { + query(other.getQuery()); + return this; + } + + @java.lang.Override + @JsonSetter("query") + public _FinalStage query(@NotNull String query) { + this.query = Objects.requireNonNull(query, "query must not be null"); + return this; + } + + @java.lang.Override + public StreamEventsDiscriminantInDataRequest build() { + return new StreamEventsDiscriminantInDataRequest(query, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupCreatedEvent.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupCreatedEvent.java new file mode 100644 index 000000000000..f4f6d2aca723 --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupCreatedEvent.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.serverSentEvents.resources.completions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.serverSentEvents.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GroupCreatedEvent.Builder.class) +public final class GroupCreatedEvent { + private final String offset; + + private final String groupId; + + private final Map additionalProperties; + + private GroupCreatedEvent(String offset, String groupId, Map additionalProperties) { + this.offset = offset; + this.groupId = groupId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("offset") + public String getOffset() { + return offset; + } + + @JsonProperty("group_id") + public String getGroupId() { + return groupId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroupCreatedEvent && equalTo((GroupCreatedEvent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GroupCreatedEvent other) { + return offset.equals(other.offset) && groupId.equals(other.groupId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.offset, this.groupId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OffsetStage builder() { + return new Builder(); + } + + public interface OffsetStage { + GroupIdStage offset(@NotNull String offset); + + Builder from(GroupCreatedEvent other); + } + + public interface GroupIdStage { + _FinalStage groupId(@NotNull String groupId); + } + + public interface _FinalStage { + GroupCreatedEvent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements OffsetStage, GroupIdStage, _FinalStage { + private String offset; + + private String groupId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GroupCreatedEvent other) { + offset(other.getOffset()); + groupId(other.getGroupId()); + return this; + } + + @java.lang.Override + @JsonSetter("offset") + public GroupIdStage offset(@NotNull String offset) { + this.offset = Objects.requireNonNull(offset, "offset must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("group_id") + public _FinalStage groupId(@NotNull String groupId) { + this.groupId = Objects.requireNonNull(groupId, "groupId must not be null"); + return this; + } + + @java.lang.Override + public GroupCreatedEvent build() { + return new GroupCreatedEvent(offset, groupId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupDeletedEvent.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupDeletedEvent.java new file mode 100644 index 000000000000..5bb0129e6041 --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupDeletedEvent.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.serverSentEvents.resources.completions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.serverSentEvents.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GroupDeletedEvent.Builder.class) +public final class GroupDeletedEvent { + private final String offset; + + private final String groupId; + + private final Map additionalProperties; + + private GroupDeletedEvent(String offset, String groupId, Map additionalProperties) { + this.offset = offset; + this.groupId = groupId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("offset") + public String getOffset() { + return offset; + } + + @JsonProperty("group_id") + public String getGroupId() { + return groupId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroupDeletedEvent && equalTo((GroupDeletedEvent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GroupDeletedEvent other) { + return offset.equals(other.offset) && groupId.equals(other.groupId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.offset, this.groupId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OffsetStage builder() { + return new Builder(); + } + + public interface OffsetStage { + GroupIdStage offset(@NotNull String offset); + + Builder from(GroupDeletedEvent other); + } + + public interface GroupIdStage { + _FinalStage groupId(@NotNull String groupId); + } + + public interface _FinalStage { + GroupDeletedEvent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements OffsetStage, GroupIdStage, _FinalStage { + private String offset; + + private String groupId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GroupDeletedEvent other) { + offset(other.getOffset()); + groupId(other.getGroupId()); + return this; + } + + @java.lang.Override + @JsonSetter("offset") + public GroupIdStage offset(@NotNull String offset) { + this.offset = Objects.requireNonNull(offset, "offset must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("group_id") + public _FinalStage groupId(@NotNull String groupId) { + this.groupId = Objects.requireNonNull(groupId, "groupId must not be null"); + return this; + } + + @java.lang.Override + public GroupDeletedEvent build() { + return new GroupDeletedEvent(offset, groupId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/StreamEventDiscriminantInData.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/StreamEventDiscriminantInData.java new file mode 100644 index 000000000000..00fc8fa562fb --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/seed/serverSentEvents/resources/completions/types/StreamEventDiscriminantInData.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.serverSentEvents.resources.completions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class StreamEventDiscriminantInData { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private StreamEventDiscriminantInData(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static StreamEventDiscriminantInData groupCreated(GroupCreatedEvent value) { + return new StreamEventDiscriminantInData(new GroupCreatedValue(value)); + } + + public static StreamEventDiscriminantInData groupDeleted(GroupDeletedEvent value) { + return new StreamEventDiscriminantInData(new GroupDeletedValue(value)); + } + + public boolean isGroupCreated() { + return value instanceof GroupCreatedValue; + } + + public boolean isGroupDeleted() { + return value instanceof GroupDeletedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getGroupCreated() { + if (isGroupCreated()) { + return Optional.of(((GroupCreatedValue) value).value); + } + return Optional.empty(); + } + + public Optional getGroupDeleted() { + if (isGroupDeleted()) { + return Optional.of(((GroupDeletedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StreamEventDiscriminantInData + && value.equals(((StreamEventDiscriminantInData) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitGroupCreated(GroupCreatedEvent groupCreated); + + T visitGroupDeleted(GroupDeletedEvent groupDeleted); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(GroupCreatedValue.class), @JsonSubTypes.Type(GroupDeletedValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("group.created") + @JsonIgnoreProperties("type") + private static final class GroupCreatedValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private GroupCreatedEvent value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GroupCreatedValue() {} + + private GroupCreatedValue(GroupCreatedEvent value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGroupCreated(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroupCreatedValue && equalTo((GroupCreatedValue) other); + } + + private boolean equalTo(GroupCreatedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "StreamEventDiscriminantInData{" + "value: " + value + "}"; + } + } + + @JsonTypeName("group.deleted") + @JsonIgnoreProperties("type") + private static final class GroupDeletedValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private GroupDeletedEvent value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GroupDeletedValue() {} + + private GroupDeletedValue(GroupDeletedEvent value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGroupDeleted(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroupDeletedValue && equalTo((GroupDeletedValue) other); + } + + private boolean equalTo(GroupDeletedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "StreamEventDiscriminantInData{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("type") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "StreamEventDiscriminantInData{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example10.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example10.java index 0fa4d819a5d3..435c9b01576e 100644 --- a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example10.java +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example10.java @@ -1,7 +1,7 @@ package com.snippets; import com.seed.serverSentEvents.SeedServerSentEventsClient; -import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; public class Example10 { public static void main(String[] args) { @@ -9,7 +9,7 @@ public static void main(String[] args) { SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); client.completions() - .streamEventsContextProtocol(StreamEventsContextProtocolRequest.builder() + .streamEventsDiscriminantInData(StreamEventsDiscriminantInDataRequest.builder() .query("query") .build()); } diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example12.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example12.java new file mode 100644 index 000000000000..fab131be5b43 --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example12.java @@ -0,0 +1,15 @@ +package com.snippets; + +import com.seed.serverSentEvents.SeedServerSentEventsClient; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; + +public class Example12 { + public static void main(String[] args) { + SeedServerSentEventsClient client = + SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); + + client.completions() + .streamEventsContextProtocol( + StreamEventsContextProtocolRequest.builder().query("").build()); + } +} diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example13.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example13.java new file mode 100644 index 000000000000..54baff8f4725 --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example13.java @@ -0,0 +1,16 @@ +package com.snippets; + +import com.seed.serverSentEvents.SeedServerSentEventsClient; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; + +public class Example13 { + public static void main(String[] args) { + SeedServerSentEventsClient client = + SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); + + client.completions() + .streamEventsContextProtocol(StreamEventsContextProtocolRequest.builder() + .query("query") + .build()); + } +} diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example14.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example14.java new file mode 100644 index 000000000000..85fa883c22fe --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example14.java @@ -0,0 +1,16 @@ +package com.snippets; + +import com.seed.serverSentEvents.SeedServerSentEventsClient; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; + +public class Example14 { + public static void main(String[] args) { + SeedServerSentEventsClient client = + SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); + + client.completions() + .streamEventsContextProtocol(StreamEventsContextProtocolRequest.builder() + .query("query") + .build()); + } +} diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example8.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example8.java index 53d94009a656..19526cdb5e89 100644 --- a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example8.java +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example8.java @@ -1,7 +1,7 @@ package com.snippets; import com.seed.serverSentEvents.SeedServerSentEventsClient; -import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; public class Example8 { public static void main(String[] args) { @@ -9,7 +9,7 @@ public static void main(String[] args) { SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); client.completions() - .streamEventsContextProtocol(StreamEventsContextProtocolRequest.builder() + .streamEventsDiscriminantInData(StreamEventsDiscriminantInDataRequest.builder() .query("query") .build()); } diff --git a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example9.java b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example9.java index 01ed1b50e8a8..f6dcd3bb94b6 100644 --- a/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example9.java +++ b/seed/java-sdk/server-sent-event-examples/no-custom-config/src/main/java/com/snippets/Example9.java @@ -1,7 +1,7 @@ package com.snippets; import com.seed.serverSentEvents.SeedServerSentEventsClient; -import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; public class Example9 { public static void main(String[] args) { @@ -9,7 +9,8 @@ public static void main(String[] args) { SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); client.completions() - .streamEventsContextProtocol( - StreamEventsContextProtocolRequest.builder().query("").build()); + .streamEventsDiscriminantInData(StreamEventsDiscriminantInDataRequest.builder() + .query("query") + .build()); } } diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/reference.md b/seed/java-sdk/server-sent-event-examples/with-wire-tests/reference.md index 4849fdc07976..357c6e72480e 100644 --- a/seed/java-sdk/server-sent-event-examples/with-wire-tests/reference.md +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/reference.md @@ -86,6 +86,51 @@ client.completions().streamEvents( + + + + +
client.completions.streamEventsDiscriminantInData(request) -> Iterable&lt;StreamEventDiscriminantInData&gt; +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.completions().streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest + .builder() + .query("query") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**query:** `String` + +
+
+
+
+ +
diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/snippet.json b/seed/java-sdk/server-sent-event-examples/with-wire-tests/snippet.json index 585bd83a3910..7abef6bb03ab 100644 --- a/seed/java-sdk/server-sent-event-examples/with-wire-tests/snippet.json +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/snippet.json @@ -104,6 +104,45 @@ "async_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEvents(\n StreamEventsRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n" } }, + { + "example_identifier": "Stream events where discriminant is embedded in data and SSE event line is empty", + "id": { + "method": "POST", + "path": "/stream-events-discriminant-in-data", + "identifier_override": "endpoint_completions.streamEventsDiscriminantInData" + }, + "snippet": { + "type": "java", + "sync_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n", + "async_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n" + } + }, + { + "example_identifier": "43ddff75", + "id": { + "method": "POST", + "path": "/stream-events-discriminant-in-data", + "identifier_override": "endpoint_completions.streamEventsDiscriminantInData" + }, + "snippet": { + "type": "java", + "sync_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n", + "async_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n" + } + }, + { + "example_identifier": "95b7c867", + "id": { + "method": "POST", + "path": "/stream-events-discriminant-in-data", + "identifier_override": "endpoint_completions.streamEventsDiscriminantInData" + }, + "snippet": { + "type": "java", + "sync_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n", + "async_client": "package com.example.usage;\n\nimport com.seed.serverSentEvents.SeedServerSentEventsClient;\nimport com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest;\n\npublic class Example {\n public static void main(String[] args) {\n SeedServerSentEventsClient client = SeedServerSentEventsClient\n .builder()\n .build();\n\n client.completions().streamEventsDiscriminantInData(\n StreamEventsDiscriminantInDataRequest\n .builder()\n .query(\"query\")\n .build()\n );\n }\n}\n" + } + }, { "example_identifier": "Stream events context protocol", "id": { diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncCompletionsClient.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncCompletionsClient.java index b31cf3e907ce..cf63ae18a794 100644 --- a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncCompletionsClient.java +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncCompletionsClient.java @@ -7,9 +7,11 @@ import com.seed.serverSentEvents.core.RequestOptions; import com.seed.serverSentEvents.resources.completions.requests.StreamCompletionRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsRequest; import com.seed.serverSentEvents.resources.completions.types.StreamEvent; import com.seed.serverSentEvents.resources.completions.types.StreamEventContextProtocol; +import com.seed.serverSentEvents.resources.completions.types.StreamEventDiscriminantInData; import com.seed.serverSentEvents.resources.completions.types.StreamedCompletion; import java.util.concurrent.CompletableFuture; @@ -48,6 +50,18 @@ public CompletableFuture> streamEvents( return this.rawClient.streamEvents(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture> streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request) { + return this.rawClient.streamEventsDiscriminantInData(request).thenApply(response -> response.body()); + } + + public CompletableFuture> streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request, RequestOptions requestOptions) { + return this.rawClient + .streamEventsDiscriminantInData(request, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture> streamEventsContextProtocol( StreamEventsContextProtocolRequest request) { return this.rawClient.streamEventsContextProtocol(request).thenApply(response -> response.body()); diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncRawCompletionsClient.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncRawCompletionsClient.java index 635c3e973f83..d33a0c2a9357 100644 --- a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncRawCompletionsClient.java +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/AsyncRawCompletionsClient.java @@ -16,9 +16,11 @@ import com.seed.serverSentEvents.resources.completions.errors.BadRequestError; import com.seed.serverSentEvents.resources.completions.requests.StreamCompletionRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsRequest; import com.seed.serverSentEvents.resources.completions.types.StreamEvent; import com.seed.serverSentEvents.resources.completions.types.StreamEventContextProtocol; +import com.seed.serverSentEvents.resources.completions.types.StreamEventDiscriminantInData; import com.seed.serverSentEvents.resources.completions.types.StreamedCompletion; import java.io.IOException; import java.util.concurrent.CompletableFuture; @@ -191,6 +193,82 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture>> + streamEventsDiscriminantInData(StreamEventsDiscriminantInDataRequest request) { + return streamEventsDiscriminantInData(request, null); + } + + public CompletableFuture>> + streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stream-events-discriminant-in-data"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new SeedServerSentEventsException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + client = client.newBuilder().callTimeout(0, TimeUnit.SECONDS).build(); + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + future.complete(new SeedServerSentEventsHttpResponse<>( + Stream.fromSse(StreamEventDiscriminantInData.class, new ResponseBodyReader(response)), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, String.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new SeedServerSentEventsApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally( + new SeedServerSentEventsException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally( + new SeedServerSentEventsException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture>> streamEventsContextProtocol(StreamEventsContextProtocolRequest request) { return streamEventsContextProtocol(request, null); diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/CompletionsClient.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/CompletionsClient.java index 350f9115c371..cfc439193fa5 100644 --- a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/CompletionsClient.java +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/CompletionsClient.java @@ -7,9 +7,11 @@ import com.seed.serverSentEvents.core.RequestOptions; import com.seed.serverSentEvents.resources.completions.requests.StreamCompletionRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsRequest; import com.seed.serverSentEvents.resources.completions.types.StreamEvent; import com.seed.serverSentEvents.resources.completions.types.StreamEventContextProtocol; +import com.seed.serverSentEvents.resources.completions.types.StreamEventDiscriminantInData; import com.seed.serverSentEvents.resources.completions.types.StreamedCompletion; public class CompletionsClient { @@ -45,6 +47,18 @@ public Iterable streamEvents(StreamEventsRequest request, RequestOp return this.rawClient.streamEvents(request, requestOptions).body(); } + public Iterable streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request) { + return this.rawClient.streamEventsDiscriminantInData(request).body(); + } + + public Iterable streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request, RequestOptions requestOptions) { + return this.rawClient + .streamEventsDiscriminantInData(request, requestOptions) + .body(); + } + public Iterable streamEventsContextProtocol( StreamEventsContextProtocolRequest request) { return this.rawClient.streamEventsContextProtocol(request).body(); diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/RawCompletionsClient.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/RawCompletionsClient.java index 346521478802..1621730b2d40 100644 --- a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/RawCompletionsClient.java +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/RawCompletionsClient.java @@ -16,9 +16,11 @@ import com.seed.serverSentEvents.resources.completions.errors.BadRequestError; import com.seed.serverSentEvents.resources.completions.requests.StreamCompletionRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsRequest; import com.seed.serverSentEvents.resources.completions.types.StreamEvent; import com.seed.serverSentEvents.resources.completions.types.StreamEventContextProtocol; +import com.seed.serverSentEvents.resources.completions.types.StreamEventDiscriminantInData; import com.seed.serverSentEvents.resources.completions.types.StreamedCompletion; import java.io.IOException; import java.util.concurrent.TimeUnit; @@ -152,6 +154,64 @@ StreamEvent.class, new ResponseBodyReader(response), "event", "[DONE]"), } } + public SeedServerSentEventsHttpResponse> streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request) { + return streamEventsDiscriminantInData(request, null); + } + + public SeedServerSentEventsHttpResponse> streamEventsDiscriminantInData( + StreamEventsDiscriminantInDataRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stream-events-discriminant-in-data"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new SeedServerSentEventsException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + client = client.newBuilder().callTimeout(0, TimeUnit.SECONDS).build(); + try { + Response response = client.newCall(okhttpRequest).execute(); + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new SeedServerSentEventsHttpResponse<>( + Stream.fromSse(StreamEventDiscriminantInData.class, new ResponseBodyReader(response)), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, String.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new SeedServerSentEventsApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new SeedServerSentEventsException("Network error executing HTTP request", e); + } + } + public SeedServerSentEventsHttpResponse> streamEventsContextProtocol( StreamEventsContextProtocolRequest request) { return streamEventsContextProtocol(request, null); diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/requests/StreamEventsDiscriminantInDataRequest.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/requests/StreamEventsDiscriminantInDataRequest.java new file mode 100644 index 000000000000..8a3fab308e22 --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/requests/StreamEventsDiscriminantInDataRequest.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.serverSentEvents.resources.completions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.serverSentEvents.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StreamEventsDiscriminantInDataRequest.Builder.class) +public final class StreamEventsDiscriminantInDataRequest { + private final String query; + + private final Map additionalProperties; + + private StreamEventsDiscriminantInDataRequest(String query, Map additionalProperties) { + this.query = query; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("query") + public String getQuery() { + return query; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StreamEventsDiscriminantInDataRequest + && equalTo((StreamEventsDiscriminantInDataRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(StreamEventsDiscriminantInDataRequest other) { + return query.equals(other.query); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.query); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static QueryStage builder() { + return new Builder(); + } + + public interface QueryStage { + _FinalStage query(@NotNull String query); + + Builder from(StreamEventsDiscriminantInDataRequest other); + } + + public interface _FinalStage { + StreamEventsDiscriminantInDataRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements QueryStage, _FinalStage { + private String query; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(StreamEventsDiscriminantInDataRequest other) { + query(other.getQuery()); + return this; + } + + @java.lang.Override + @JsonSetter("query") + public _FinalStage query(@NotNull String query) { + this.query = Objects.requireNonNull(query, "query must not be null"); + return this; + } + + @java.lang.Override + public StreamEventsDiscriminantInDataRequest build() { + return new StreamEventsDiscriminantInDataRequest(query, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupCreatedEvent.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupCreatedEvent.java new file mode 100644 index 000000000000..f4f6d2aca723 --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupCreatedEvent.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.serverSentEvents.resources.completions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.serverSentEvents.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GroupCreatedEvent.Builder.class) +public final class GroupCreatedEvent { + private final String offset; + + private final String groupId; + + private final Map additionalProperties; + + private GroupCreatedEvent(String offset, String groupId, Map additionalProperties) { + this.offset = offset; + this.groupId = groupId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("offset") + public String getOffset() { + return offset; + } + + @JsonProperty("group_id") + public String getGroupId() { + return groupId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroupCreatedEvent && equalTo((GroupCreatedEvent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GroupCreatedEvent other) { + return offset.equals(other.offset) && groupId.equals(other.groupId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.offset, this.groupId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OffsetStage builder() { + return new Builder(); + } + + public interface OffsetStage { + GroupIdStage offset(@NotNull String offset); + + Builder from(GroupCreatedEvent other); + } + + public interface GroupIdStage { + _FinalStage groupId(@NotNull String groupId); + } + + public interface _FinalStage { + GroupCreatedEvent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements OffsetStage, GroupIdStage, _FinalStage { + private String offset; + + private String groupId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GroupCreatedEvent other) { + offset(other.getOffset()); + groupId(other.getGroupId()); + return this; + } + + @java.lang.Override + @JsonSetter("offset") + public GroupIdStage offset(@NotNull String offset) { + this.offset = Objects.requireNonNull(offset, "offset must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("group_id") + public _FinalStage groupId(@NotNull String groupId) { + this.groupId = Objects.requireNonNull(groupId, "groupId must not be null"); + return this; + } + + @java.lang.Override + public GroupCreatedEvent build() { + return new GroupCreatedEvent(offset, groupId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupDeletedEvent.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupDeletedEvent.java new file mode 100644 index 000000000000..5bb0129e6041 --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/GroupDeletedEvent.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.serverSentEvents.resources.completions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.serverSentEvents.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GroupDeletedEvent.Builder.class) +public final class GroupDeletedEvent { + private final String offset; + + private final String groupId; + + private final Map additionalProperties; + + private GroupDeletedEvent(String offset, String groupId, Map additionalProperties) { + this.offset = offset; + this.groupId = groupId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("offset") + public String getOffset() { + return offset; + } + + @JsonProperty("group_id") + public String getGroupId() { + return groupId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroupDeletedEvent && equalTo((GroupDeletedEvent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GroupDeletedEvent other) { + return offset.equals(other.offset) && groupId.equals(other.groupId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.offset, this.groupId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OffsetStage builder() { + return new Builder(); + } + + public interface OffsetStage { + GroupIdStage offset(@NotNull String offset); + + Builder from(GroupDeletedEvent other); + } + + public interface GroupIdStage { + _FinalStage groupId(@NotNull String groupId); + } + + public interface _FinalStage { + GroupDeletedEvent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements OffsetStage, GroupIdStage, _FinalStage { + private String offset; + + private String groupId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GroupDeletedEvent other) { + offset(other.getOffset()); + groupId(other.getGroupId()); + return this; + } + + @java.lang.Override + @JsonSetter("offset") + public GroupIdStage offset(@NotNull String offset) { + this.offset = Objects.requireNonNull(offset, "offset must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("group_id") + public _FinalStage groupId(@NotNull String groupId) { + this.groupId = Objects.requireNonNull(groupId, "groupId must not be null"); + return this; + } + + @java.lang.Override + public GroupDeletedEvent build() { + return new GroupDeletedEvent(offset, groupId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/StreamEventDiscriminantInData.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/StreamEventDiscriminantInData.java new file mode 100644 index 000000000000..00fc8fa562fb --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/seed/serverSentEvents/resources/completions/types/StreamEventDiscriminantInData.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.serverSentEvents.resources.completions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class StreamEventDiscriminantInData { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private StreamEventDiscriminantInData(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static StreamEventDiscriminantInData groupCreated(GroupCreatedEvent value) { + return new StreamEventDiscriminantInData(new GroupCreatedValue(value)); + } + + public static StreamEventDiscriminantInData groupDeleted(GroupDeletedEvent value) { + return new StreamEventDiscriminantInData(new GroupDeletedValue(value)); + } + + public boolean isGroupCreated() { + return value instanceof GroupCreatedValue; + } + + public boolean isGroupDeleted() { + return value instanceof GroupDeletedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getGroupCreated() { + if (isGroupCreated()) { + return Optional.of(((GroupCreatedValue) value).value); + } + return Optional.empty(); + } + + public Optional getGroupDeleted() { + if (isGroupDeleted()) { + return Optional.of(((GroupDeletedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StreamEventDiscriminantInData + && value.equals(((StreamEventDiscriminantInData) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitGroupCreated(GroupCreatedEvent groupCreated); + + T visitGroupDeleted(GroupDeletedEvent groupDeleted); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(GroupCreatedValue.class), @JsonSubTypes.Type(GroupDeletedValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("group.created") + @JsonIgnoreProperties("type") + private static final class GroupCreatedValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private GroupCreatedEvent value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GroupCreatedValue() {} + + private GroupCreatedValue(GroupCreatedEvent value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGroupCreated(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroupCreatedValue && equalTo((GroupCreatedValue) other); + } + + private boolean equalTo(GroupCreatedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "StreamEventDiscriminantInData{" + "value: " + value + "}"; + } + } + + @JsonTypeName("group.deleted") + @JsonIgnoreProperties("type") + private static final class GroupDeletedValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private GroupDeletedEvent value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GroupDeletedValue() {} + + private GroupDeletedValue(GroupDeletedEvent value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGroupDeleted(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroupDeletedValue && equalTo((GroupDeletedValue) other); + } + + private boolean equalTo(GroupDeletedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "StreamEventDiscriminantInData{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("type") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "StreamEventDiscriminantInData{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example10.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example10.java index 0fa4d819a5d3..435c9b01576e 100644 --- a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example10.java +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example10.java @@ -1,7 +1,7 @@ package com.snippets; import com.seed.serverSentEvents.SeedServerSentEventsClient; -import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; public class Example10 { public static void main(String[] args) { @@ -9,7 +9,7 @@ public static void main(String[] args) { SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); client.completions() - .streamEventsContextProtocol(StreamEventsContextProtocolRequest.builder() + .streamEventsDiscriminantInData(StreamEventsDiscriminantInDataRequest.builder() .query("query") .build()); } diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example12.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example12.java new file mode 100644 index 000000000000..fab131be5b43 --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example12.java @@ -0,0 +1,15 @@ +package com.snippets; + +import com.seed.serverSentEvents.SeedServerSentEventsClient; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; + +public class Example12 { + public static void main(String[] args) { + SeedServerSentEventsClient client = + SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); + + client.completions() + .streamEventsContextProtocol( + StreamEventsContextProtocolRequest.builder().query("").build()); + } +} diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example13.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example13.java new file mode 100644 index 000000000000..54baff8f4725 --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example13.java @@ -0,0 +1,16 @@ +package com.snippets; + +import com.seed.serverSentEvents.SeedServerSentEventsClient; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; + +public class Example13 { + public static void main(String[] args) { + SeedServerSentEventsClient client = + SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); + + client.completions() + .streamEventsContextProtocol(StreamEventsContextProtocolRequest.builder() + .query("query") + .build()); + } +} diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example14.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example14.java new file mode 100644 index 000000000000..85fa883c22fe --- /dev/null +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example14.java @@ -0,0 +1,16 @@ +package com.snippets; + +import com.seed.serverSentEvents.SeedServerSentEventsClient; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; + +public class Example14 { + public static void main(String[] args) { + SeedServerSentEventsClient client = + SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); + + client.completions() + .streamEventsContextProtocol(StreamEventsContextProtocolRequest.builder() + .query("query") + .build()); + } +} diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example8.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example8.java index 53d94009a656..19526cdb5e89 100644 --- a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example8.java +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example8.java @@ -1,7 +1,7 @@ package com.snippets; import com.seed.serverSentEvents.SeedServerSentEventsClient; -import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; public class Example8 { public static void main(String[] args) { @@ -9,7 +9,7 @@ public static void main(String[] args) { SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); client.completions() - .streamEventsContextProtocol(StreamEventsContextProtocolRequest.builder() + .streamEventsDiscriminantInData(StreamEventsDiscriminantInDataRequest.builder() .query("query") .build()); } diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example9.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example9.java index 01ed1b50e8a8..f6dcd3bb94b6 100644 --- a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example9.java +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/main/java/com/snippets/Example9.java @@ -1,7 +1,7 @@ package com.snippets; import com.seed.serverSentEvents.SeedServerSentEventsClient; -import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; public class Example9 { public static void main(String[] args) { @@ -9,7 +9,8 @@ public static void main(String[] args) { SeedServerSentEventsClient.builder().url("https://api.fern.com").build(); client.completions() - .streamEventsContextProtocol( - StreamEventsContextProtocolRequest.builder().query("").build()); + .streamEventsDiscriminantInData(StreamEventsDiscriminantInDataRequest.builder() + .query("query") + .build()); } } diff --git a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/test/java/com/seed/serverSentEvents/CompletionsWireTest.java b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/test/java/com/seed/serverSentEvents/CompletionsWireTest.java index e67115845524..b8a3eec2946a 100644 --- a/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/test/java/com/seed/serverSentEvents/CompletionsWireTest.java +++ b/seed/java-sdk/server-sent-event-examples/with-wire-tests/src/test/java/com/seed/serverSentEvents/CompletionsWireTest.java @@ -5,9 +5,11 @@ import com.seed.serverSentEvents.core.ObjectMappers; import com.seed.serverSentEvents.resources.completions.requests.StreamCompletionRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsContextProtocolRequest; +import com.seed.serverSentEvents.resources.completions.requests.StreamEventsDiscriminantInDataRequest; import com.seed.serverSentEvents.resources.completions.requests.StreamEventsRequest; import com.seed.serverSentEvents.resources.completions.types.StreamEvent; import com.seed.serverSentEvents.resources.completions.types.StreamEventContextProtocol; +import com.seed.serverSentEvents.resources.completions.types.StreamEventDiscriminantInData; import com.seed.serverSentEvents.resources.completions.types.StreamedCompletion; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; @@ -128,6 +130,54 @@ else if (actualJson.has("kind")) Assertions.assertFalse(responseJson.isEmpty()); } + @Test + public void testStreamEventsDiscriminantInData() throws Exception { + server.enqueue(new MockResponse().setResponseCode(200).setBody("{}")); + Iterable response = client.completions() + .streamEventsDiscriminantInData(StreamEventsDiscriminantInDataRequest.builder() + .query("query") + .build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("POST", request.getMethod()); + // Validate request body + String actualRequestBody = request.getBody().readUtf8(); + String expectedRequestBody = "" + "{\n" + " \"query\": \"query\"\n" + "}"; + JsonNode actualJson = objectMapper.readTree(actualRequestBody); + JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); + Assertions.assertTrue(jsonEquals(expectedJson, actualJson), "Request body structure does not match expected"); + if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { + String discriminator = null; + if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); + else if (actualJson.has("_type")) + discriminator = actualJson.get("_type").asText(); + else if (actualJson.has("kind")) + discriminator = actualJson.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualJson.isNull()) { + Assertions.assertTrue( + actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), + "request should be a valid JSON value"); + } + + if (actualJson.isArray()) { + Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); + } + if (actualJson.isObject()) { + Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); + } + + // Validate response deserialization + Assertions.assertNotNull(response, "Response should not be null"); + // Verify the response can be serialized back to JSON + String responseJson = objectMapper.writeValueAsString(response); + Assertions.assertNotNull(responseJson); + Assertions.assertFalse(responseJson.isEmpty()); + } + @Test public void testStreamEventsContextProtocol() throws Exception { server.enqueue(new MockResponse().setResponseCode(200).setBody("{}")); From 80b1bd402c261706ef91205b4f3571c4bedb12a9 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:56:45 -0400 Subject: [PATCH 24/43] chore(openapi): update openapi seed (#15572) Co-authored-by: patrickthornton <70873350+patrickthornton@users.noreply.github.com> --- .../server-sent-event-examples/openapi.yml | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/seed/openapi/server-sent-event-examples/openapi.yml b/seed/openapi/server-sent-event-examples/openapi.yml index 27a3db060721..d205b3132328 100644 --- a/seed/openapi/server-sent-event-examples/openapi.yml +++ b/seed/openapi/server-sent-event-examples/openapi.yml @@ -79,6 +79,38 @@ paths: Bad request: value: query: '' + /stream-events-discriminant-in-data: + post: + operationId: completions_streamEventsDiscriminantInData + tags: + - Completions + parameters: [] + responses: + '204': + description: No content + '400': + description: BadRequestError + content: + application/json: + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + query: + type: string + examples: + - query + required: + - query + examples: + Stream events where discriminant is embedded in data and SSE event line is empty: + value: + query: query /stream-events-context-protocol: post: operationId: completions_streamEventsContextProtocol @@ -195,6 +227,51 @@ components: - $ref: '#/components/schemas/EventEvent' required: - event + GroupCreatedEvent: + title: GroupCreatedEvent + type: object + properties: + offset: + type: string + group_id: + type: string + required: + - offset + - group_id + GroupDeletedEvent: + title: GroupDeletedEvent + type: object + properties: + offset: + type: string + group_id: + type: string + required: + - offset + - group_id + StreamEventDiscriminantInData: + title: StreamEventDiscriminantInData + oneOf: + - type: object + allOf: + - type: object + properties: + type: + type: string + const: group.created + - $ref: '#/components/schemas/GroupCreatedEvent' + required: + - type + - type: object + allOf: + - type: object + properties: + type: + type: string + const: group.deleted + - $ref: '#/components/schemas/GroupDeletedEvent' + required: + - type StreamEvent: title: StreamEvent oneOf: From a5ffd374f3329d4f8f937e706bbf93c719b2df23 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:57:05 -0400 Subject: [PATCH 25/43] chore(csharp): update csharp-sdk seed (#15578) Co-authored-by: patrickthornton <70873350+patrickthornton@users.noreply.github.com> --- .../Snippets/Example10.cs | 4 +- .../Snippets/Example12.cs | 23 ++ .../Snippets/Example13.cs | 23 ++ .../Snippets/Example14.cs | 23 ++ .../Snippets/Example8.cs | 4 +- .../Snippets/Example9.cs | 6 +- .../server-sent-event-examples/reference.md | 42 +++ .../server-sent-event-examples/snippet.json | 12 + .../Completions/CompletionsClient.cs | 79 +++++ .../Completions/ICompletionsClient.cs | 6 + .../StreamEventsDiscriminantInDataRequest.cs | 17 + .../Completions/Types/GroupCreatedEvent.cs | 31 ++ .../Completions/Types/GroupDeletedEvent.cs | 31 ++ .../Types/StreamEventDiscriminantInData.cs | 292 ++++++++++++++++++ 14 files changed, 586 insertions(+), 7 deletions(-) create mode 100644 seed/csharp-sdk/server-sent-event-examples/Snippets/Example12.cs create mode 100644 seed/csharp-sdk/server-sent-event-examples/Snippets/Example13.cs create mode 100644 seed/csharp-sdk/server-sent-event-examples/Snippets/Example14.cs create mode 100644 seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Requests/StreamEventsDiscriminantInDataRequest.cs create mode 100644 seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/GroupCreatedEvent.cs create mode 100644 seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/GroupDeletedEvent.cs create mode 100644 seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/StreamEventDiscriminantInData.cs diff --git a/seed/csharp-sdk/server-sent-event-examples/Snippets/Example10.cs b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example10.cs index 6d2ad206f6f0..9365634dc4b0 100644 --- a/seed/csharp-sdk/server-sent-event-examples/Snippets/Example10.cs +++ b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example10.cs @@ -9,8 +9,8 @@ public async Task Example10() { } ); - await foreach (var item in client.Completions.StreamEventsContextProtocolAsync( - new StreamEventsContextProtocolRequest { + await foreach (var item in client.Completions.StreamEventsDiscriminantInDataAsync( + new StreamEventsDiscriminantInDataRequest { Query = "query" } )) diff --git a/seed/csharp-sdk/server-sent-event-examples/Snippets/Example12.cs b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example12.cs new file mode 100644 index 000000000000..72b77275fecc --- /dev/null +++ b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example12.cs @@ -0,0 +1,23 @@ +using SeedServerSentEvents; + +public partial class Examples +{ + public async Task Example12() { + var client = new SeedServerSentEventsClient( + clientOptions: new ClientOptions { + BaseUrl = "https://api.fern.com" + } + ); + + await foreach (var item in client.Completions.StreamEventsContextProtocolAsync( + new StreamEventsContextProtocolRequest { + Query = "" + } + )) + { + /* consume each item */ + } + ; + } + +} diff --git a/seed/csharp-sdk/server-sent-event-examples/Snippets/Example13.cs b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example13.cs new file mode 100644 index 000000000000..de8afca7f12f --- /dev/null +++ b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example13.cs @@ -0,0 +1,23 @@ +using SeedServerSentEvents; + +public partial class Examples +{ + public async Task Example13() { + var client = new SeedServerSentEventsClient( + clientOptions: new ClientOptions { + BaseUrl = "https://api.fern.com" + } + ); + + await foreach (var item in client.Completions.StreamEventsContextProtocolAsync( + new StreamEventsContextProtocolRequest { + Query = "query" + } + )) + { + /* consume each item */ + } + ; + } + +} diff --git a/seed/csharp-sdk/server-sent-event-examples/Snippets/Example14.cs b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example14.cs new file mode 100644 index 000000000000..b542902ce382 --- /dev/null +++ b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example14.cs @@ -0,0 +1,23 @@ +using SeedServerSentEvents; + +public partial class Examples +{ + public async Task Example14() { + var client = new SeedServerSentEventsClient( + clientOptions: new ClientOptions { + BaseUrl = "https://api.fern.com" + } + ); + + await foreach (var item in client.Completions.StreamEventsContextProtocolAsync( + new StreamEventsContextProtocolRequest { + Query = "query" + } + )) + { + /* consume each item */ + } + ; + } + +} diff --git a/seed/csharp-sdk/server-sent-event-examples/Snippets/Example8.cs b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example8.cs index bedd849c1a37..ae51a9ca74e9 100644 --- a/seed/csharp-sdk/server-sent-event-examples/Snippets/Example8.cs +++ b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example8.cs @@ -9,8 +9,8 @@ public async Task Example8() { } ); - await foreach (var item in client.Completions.StreamEventsContextProtocolAsync( - new StreamEventsContextProtocolRequest { + await foreach (var item in client.Completions.StreamEventsDiscriminantInDataAsync( + new StreamEventsDiscriminantInDataRequest { Query = "query" } )) diff --git a/seed/csharp-sdk/server-sent-event-examples/Snippets/Example9.cs b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example9.cs index 47ff5fcff4b6..eafacf6dd2e0 100644 --- a/seed/csharp-sdk/server-sent-event-examples/Snippets/Example9.cs +++ b/seed/csharp-sdk/server-sent-event-examples/Snippets/Example9.cs @@ -9,9 +9,9 @@ public async Task Example9() { } ); - await foreach (var item in client.Completions.StreamEventsContextProtocolAsync( - new StreamEventsContextProtocolRequest { - Query = "" + await foreach (var item in client.Completions.StreamEventsDiscriminantInDataAsync( + new StreamEventsDiscriminantInDataRequest { + Query = "query" } )) { diff --git a/seed/csharp-sdk/server-sent-event-examples/reference.md b/seed/csharp-sdk/server-sent-event-examples/reference.md index 7e3705bd06b1..26c7285a4ef8 100644 --- a/seed/csharp-sdk/server-sent-event-examples/reference.md +++ b/seed/csharp-sdk/server-sent-event-examples/reference.md @@ -76,6 +76,48 @@ client.Completions.StreamEventsAsync(new StreamEventsRequest { Query = "query" } + + + + +
client.Completions.StreamEventsDiscriminantInDataAsync(StreamEventsDiscriminantInDataRequest { ... }) -> IAsyncEnumerable<StreamEventDiscriminantInData> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +client.Completions.StreamEventsDiscriminantInDataAsync( + new StreamEventsDiscriminantInDataRequest { Query = "query" } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `StreamEventsDiscriminantInDataRequest` + +
+
+
+
+ +
diff --git a/seed/csharp-sdk/server-sent-event-examples/snippet.json b/seed/csharp-sdk/server-sent-event-examples/snippet.json index 4b98451a3684..7f20b0e0eeb6 100644 --- a/seed/csharp-sdk/server-sent-event-examples/snippet.json +++ b/seed/csharp-sdk/server-sent-event-examples/snippet.json @@ -49,6 +49,18 @@ "client": "using SeedServerSentEvents;\n\nvar client = new SeedServerSentEventsClient();\nvar items = client.Completions.StreamEventsAsync(new StreamEventsRequest { Query = \"\" });\n\nawait foreach (var item in items)\n{\n // do something with item\n}\n" } }, + { + "example_identifier": "Stream events where discriminant is embedded in data and SSE event line is empty", + "id": { + "path": "/stream-events-discriminant-in-data", + "method": "POST", + "identifier_override": "endpoint_completions.streamEventsDiscriminantInData" + }, + "snippet": { + "type": "csharp", + "client": "using SeedServerSentEvents;\n\nvar client = new SeedServerSentEventsClient();\nvar items = client.Completions.StreamEventsDiscriminantInDataAsync(\n new StreamEventsDiscriminantInDataRequest { Query = \"query\" }\n);\n\nawait foreach (var item in items)\n{\n // do something with item\n}\n" + } + }, { "example_identifier": "Stream events context protocol", "id": { diff --git a/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/CompletionsClient.cs b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/CompletionsClient.cs index f9593fffe2aa..bd4e2c274908 100644 --- a/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/CompletionsClient.cs +++ b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/CompletionsClient.cs @@ -175,6 +175,85 @@ var item in SseParser } } + /// + /// client.Completions.StreamEventsDiscriminantInDataAsync( + /// new StreamEventsDiscriminantInDataRequest { Query = "query" } + /// ); + /// + public async IAsyncEnumerable StreamEventsDiscriminantInDataAsync( + StreamEventsDiscriminantInDataRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _headers = await new SeedServerSentEvents.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Post, + Path = "stream-events-discriminant-in-data", + Body = request, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + await foreach ( + var item in SseParser + .Create(await response.Raw.Content.ReadAsStreamAsync()) + .EnumerateAsync(cancellationToken) + ) + { + if (!string.IsNullOrEmpty(item.Data)) + { + StreamEventDiscriminantInData? result; + try + { + result = JsonUtils.Deserialize(item.Data); + } + catch (JsonException) + { + throw new SeedServerSentEventsException( + $"Unable to deserialize JSON response 'item.Data'" + ); + } + } + } + yield break; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new SeedServerSentEventsApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + /// /// client.Completions.StreamEventsContextProtocolAsync( /// new StreamEventsContextProtocolRequest { Query = "query" } diff --git a/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/ICompletionsClient.cs b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/ICompletionsClient.cs index 254539fc3b99..111e225c821d 100644 --- a/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/ICompletionsClient.cs +++ b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/ICompletionsClient.cs @@ -14,6 +14,12 @@ IAsyncEnumerable StreamEventsAsync( CancellationToken cancellationToken = default ); + IAsyncEnumerable StreamEventsDiscriminantInDataAsync( + StreamEventsDiscriminantInDataRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + IAsyncEnumerable StreamEventsContextProtocolAsync( StreamEventsContextProtocolRequest request, RequestOptions? options = null, diff --git a/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Requests/StreamEventsDiscriminantInDataRequest.cs b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Requests/StreamEventsDiscriminantInDataRequest.cs new file mode 100644 index 000000000000..af65ac95ef94 --- /dev/null +++ b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Requests/StreamEventsDiscriminantInDataRequest.cs @@ -0,0 +1,17 @@ +using global::System.Text.Json.Serialization; +using SeedServerSentEvents.Core; + +namespace SeedServerSentEvents; + +[Serializable] +public record StreamEventsDiscriminantInDataRequest +{ + [JsonPropertyName("query")] + public required string Query { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/GroupCreatedEvent.cs b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/GroupCreatedEvent.cs new file mode 100644 index 000000000000..e4cab7b92270 --- /dev/null +++ b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/GroupCreatedEvent.cs @@ -0,0 +1,31 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SeedServerSentEvents.Core; + +namespace SeedServerSentEvents; + +[Serializable] +public record GroupCreatedEvent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("offset")] + public required string Offset { get; set; } + + [JsonPropertyName("group_id")] + public required string GroupId { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/GroupDeletedEvent.cs b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/GroupDeletedEvent.cs new file mode 100644 index 000000000000..4cdefda6868a --- /dev/null +++ b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/GroupDeletedEvent.cs @@ -0,0 +1,31 @@ +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using SeedServerSentEvents.Core; + +namespace SeedServerSentEvents; + +[Serializable] +public record GroupDeletedEvent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("offset")] + public required string Offset { get; set; } + + [JsonPropertyName("group_id")] + public required string GroupId { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/StreamEventDiscriminantInData.cs b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/StreamEventDiscriminantInData.cs new file mode 100644 index 000000000000..5cb8366c3e48 --- /dev/null +++ b/seed/csharp-sdk/server-sent-event-examples/src/SeedServerSentEvents/Completions/Types/StreamEventDiscriminantInData.cs @@ -0,0 +1,292 @@ +// ReSharper disable NullableWarningSuppressionIsUsed +// ReSharper disable InconsistentNaming + +using global::System.Text.Json; +using global::System.Text.Json.Nodes; +using global::System.Text.Json.Serialization; +using SeedServerSentEvents.Core; + +namespace SeedServerSentEvents; + +[JsonConverter(typeof(StreamEventDiscriminantInData.JsonConverter))] +[Serializable] +public record StreamEventDiscriminantInData +{ + internal StreamEventDiscriminantInData(string type, object? value) + { + Type = type; + Value = value; + } + + /// + /// Create an instance of StreamEventDiscriminantInData with . + /// + public StreamEventDiscriminantInData(StreamEventDiscriminantInData.GroupCreated value) + { + Type = "group.created"; + Value = value.Value; + } + + /// + /// Create an instance of StreamEventDiscriminantInData with . + /// + public StreamEventDiscriminantInData(StreamEventDiscriminantInData.GroupDeleted value) + { + Type = "group.deleted"; + Value = value.Value; + } + + /// + /// Discriminant value + /// + [JsonPropertyName("type")] + public string Type { get; internal set; } + + /// + /// Discriminated union value + /// + public object? Value { get; internal set; } + + /// + /// Returns true if is "group.created" + /// + public bool IsGroupCreated => Type == "group.created"; + + /// + /// Returns true if is "group.deleted" + /// + public bool IsGroupDeleted => Type == "group.deleted"; + + /// + /// Returns the value as a if is 'group.created', otherwise throws an exception. + /// + /// Thrown when is not 'group.created'. + public SeedServerSentEvents.GroupCreatedEvent AsGroupCreated() => + IsGroupCreated + ? (SeedServerSentEvents.GroupCreatedEvent)Value! + : throw new global::System.Exception( + "StreamEventDiscriminantInData.Type is not 'group.created'" + ); + + /// + /// Returns the value as a if is 'group.deleted', otherwise throws an exception. + /// + /// Thrown when is not 'group.deleted'. + public SeedServerSentEvents.GroupDeletedEvent AsGroupDeleted() => + IsGroupDeleted + ? (SeedServerSentEvents.GroupDeletedEvent)Value! + : throw new global::System.Exception( + "StreamEventDiscriminantInData.Type is not 'group.deleted'" + ); + + public T Match( + Func onGroupCreated, + Func onGroupDeleted, + Func onUnknown_ + ) + { + return Type switch + { + "group.created" => onGroupCreated(AsGroupCreated()), + "group.deleted" => onGroupDeleted(AsGroupDeleted()), + _ => onUnknown_(Type, Value), + }; + } + + public void Visit( + Action onGroupCreated, + Action onGroupDeleted, + Action onUnknown_ + ) + { + switch (Type) + { + case "group.created": + onGroupCreated(AsGroupCreated()); + break; + case "group.deleted": + onGroupDeleted(AsGroupDeleted()); + break; + default: + onUnknown_(Type, Value); + break; + } + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsGroupCreated(out SeedServerSentEvents.GroupCreatedEvent? value) + { + if (Type == "group.created") + { + value = (SeedServerSentEvents.GroupCreatedEvent)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsGroupDeleted(out SeedServerSentEvents.GroupDeletedEvent? value) + { + if (Type == "group.deleted") + { + value = (SeedServerSentEvents.GroupDeletedEvent)Value!; + return true; + } + value = null; + return false; + } + + public override string ToString() => JsonUtils.Serialize(this); + + public static implicit operator StreamEventDiscriminantInData( + StreamEventDiscriminantInData.GroupCreated value + ) => new(value); + + public static implicit operator StreamEventDiscriminantInData( + StreamEventDiscriminantInData.GroupDeleted value + ) => new(value); + + [Serializable] + internal sealed class JsonConverter : JsonConverter + { + public override bool CanConvert(global::System.Type typeToConvert) => + typeof(StreamEventDiscriminantInData).IsAssignableFrom(typeToConvert); + + public override StreamEventDiscriminantInData Read( + ref Utf8JsonReader reader, + global::System.Type typeToConvert, + JsonSerializerOptions options + ) + { + var json = JsonElement.ParseValue(ref reader); + if (!json.TryGetProperty("type", out var discriminatorElement)) + { + throw new JsonException("Missing discriminator property 'type'"); + } + if (discriminatorElement.ValueKind != JsonValueKind.String) + { + if (discriminatorElement.ValueKind == JsonValueKind.Null) + { + throw new JsonException("Discriminator property 'type' is null"); + } + + throw new JsonException( + $"Discriminator property 'type' is not a string, instead is {discriminatorElement.ToString()}" + ); + } + + var discriminator = + discriminatorElement.GetString() + ?? throw new JsonException("Discriminator property 'type' is null"); + + // Strip the discriminant property to prevent it from leaking into AdditionalProperties + var jsonObject = System.Text.Json.Nodes.JsonObject.Create(json); + jsonObject?.Remove("type"); + var jsonWithoutDiscriminator = + jsonObject != null ? JsonSerializer.SerializeToElement(jsonObject, options) : json; + + var value = discriminator switch + { + "group.created" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize SeedServerSentEvents.GroupCreatedEvent" + ), + "group.deleted" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize SeedServerSentEvents.GroupDeletedEvent" + ), + _ => json.Deserialize(options), + }; + return new StreamEventDiscriminantInData(discriminator, value); + } + + public override void Write( + Utf8JsonWriter writer, + StreamEventDiscriminantInData value, + JsonSerializerOptions options + ) + { + JsonNode json = + value.Type switch + { + "group.created" => JsonSerializer.SerializeToNode(value.Value, options), + "group.deleted" => JsonSerializer.SerializeToNode(value.Value, options), + _ => JsonSerializer.SerializeToNode(value.Value, options), + } ?? new JsonObject(); + json["type"] = value.Type; + json.WriteTo(writer, options); + } + + public override StreamEventDiscriminantInData ReadAsPropertyName( + ref Utf8JsonReader reader, + global::System.Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new JsonException("The JSON property name could not be read as a string."); + return new StreamEventDiscriminantInData(stringValue, stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + StreamEventDiscriminantInData value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Type); + } + } + + /// + /// Discriminated union type for group.created + /// + [Serializable] + public struct GroupCreated + { + public GroupCreated(SeedServerSentEvents.GroupCreatedEvent value) + { + Value = value; + } + + internal SeedServerSentEvents.GroupCreatedEvent Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator StreamEventDiscriminantInData.GroupCreated( + SeedServerSentEvents.GroupCreatedEvent value + ) => new(value); + } + + /// + /// Discriminated union type for group.deleted + /// + [Serializable] + public struct GroupDeleted + { + public GroupDeleted(SeedServerSentEvents.GroupDeletedEvent value) + { + Value = value; + } + + internal SeedServerSentEvents.GroupDeletedEvent Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator StreamEventDiscriminantInData.GroupDeleted( + SeedServerSentEvents.GroupDeletedEvent value + ) => new(value); + } +} From 627fbf8147a08be0ffcda6c41be534be60b0115e Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:57:08 -0400 Subject: [PATCH 26/43] chore(swift): update swift-sdk seed (#15573) Co-authored-by: patrickthornton <70873350+patrickthornton@users.noreply.github.com> --- .../Snippets/Example10.swift | 2 +- .../Snippets/Example12.swift | 10 ++++ .../Snippets/Example13.swift | 10 ++++ .../Snippets/Example14.swift | 10 ++++ .../Snippets/Example8.swift | 2 +- .../Snippets/Example9.swift | 2 +- ...treamEventsDiscriminantInDataRequest.swift | 34 +++++++++++ .../Completions/CompletionsClient.swift | 10 ++++ .../Sources/Schemas/GroupCreatedEvent.swift | 38 +++++++++++++ .../Sources/Schemas/GroupDeletedEvent.swift | 38 +++++++++++++ .../StreamEventDiscriminantInData.swift | 40 +++++++++++++ .../server-sent-event-examples/reference.md | 57 +++++++++++++++++++ 12 files changed, 250 insertions(+), 3 deletions(-) create mode 100644 seed/swift-sdk/server-sent-event-examples/Snippets/Example12.swift create mode 100644 seed/swift-sdk/server-sent-event-examples/Snippets/Example13.swift create mode 100644 seed/swift-sdk/server-sent-event-examples/Snippets/Example14.swift create mode 100644 seed/swift-sdk/server-sent-event-examples/Sources/Requests/Requests+StreamEventsDiscriminantInDataRequest.swift create mode 100644 seed/swift-sdk/server-sent-event-examples/Sources/Schemas/GroupCreatedEvent.swift create mode 100644 seed/swift-sdk/server-sent-event-examples/Sources/Schemas/GroupDeletedEvent.swift create mode 100644 seed/swift-sdk/server-sent-event-examples/Sources/Schemas/StreamEventDiscriminantInData.swift diff --git a/seed/swift-sdk/server-sent-event-examples/Snippets/Example10.swift b/seed/swift-sdk/server-sent-event-examples/Snippets/Example10.swift index 8f0bc78c138e..59e82c1da9ca 100644 --- a/seed/swift-sdk/server-sent-event-examples/Snippets/Example10.swift +++ b/seed/swift-sdk/server-sent-event-examples/Snippets/Example10.swift @@ -4,7 +4,7 @@ import ServerSentEvents private func main() async throws { let client = ServerSentEventsClient(baseURL: "https://api.fern.com") - _ = try await client.completions.streamEventsContextProtocol(request: .init(query: "query")) + _ = try await client.completions.streamEventsDiscriminantInData(request: .init(query: "query")) } try await main() diff --git a/seed/swift-sdk/server-sent-event-examples/Snippets/Example12.swift b/seed/swift-sdk/server-sent-event-examples/Snippets/Example12.swift new file mode 100644 index 000000000000..ba0611335f06 --- /dev/null +++ b/seed/swift-sdk/server-sent-event-examples/Snippets/Example12.swift @@ -0,0 +1,10 @@ +import Foundation +import ServerSentEvents + +private func main() async throws { + let client = ServerSentEventsClient(baseURL: "https://api.fern.com") + + _ = try await client.completions.streamEventsContextProtocol(request: .init(query: "")) +} + +try await main() diff --git a/seed/swift-sdk/server-sent-event-examples/Snippets/Example13.swift b/seed/swift-sdk/server-sent-event-examples/Snippets/Example13.swift new file mode 100644 index 000000000000..8f0bc78c138e --- /dev/null +++ b/seed/swift-sdk/server-sent-event-examples/Snippets/Example13.swift @@ -0,0 +1,10 @@ +import Foundation +import ServerSentEvents + +private func main() async throws { + let client = ServerSentEventsClient(baseURL: "https://api.fern.com") + + _ = try await client.completions.streamEventsContextProtocol(request: .init(query: "query")) +} + +try await main() diff --git a/seed/swift-sdk/server-sent-event-examples/Snippets/Example14.swift b/seed/swift-sdk/server-sent-event-examples/Snippets/Example14.swift new file mode 100644 index 000000000000..8f0bc78c138e --- /dev/null +++ b/seed/swift-sdk/server-sent-event-examples/Snippets/Example14.swift @@ -0,0 +1,10 @@ +import Foundation +import ServerSentEvents + +private func main() async throws { + let client = ServerSentEventsClient(baseURL: "https://api.fern.com") + + _ = try await client.completions.streamEventsContextProtocol(request: .init(query: "query")) +} + +try await main() diff --git a/seed/swift-sdk/server-sent-event-examples/Snippets/Example8.swift b/seed/swift-sdk/server-sent-event-examples/Snippets/Example8.swift index 8f0bc78c138e..59e82c1da9ca 100644 --- a/seed/swift-sdk/server-sent-event-examples/Snippets/Example8.swift +++ b/seed/swift-sdk/server-sent-event-examples/Snippets/Example8.swift @@ -4,7 +4,7 @@ import ServerSentEvents private func main() async throws { let client = ServerSentEventsClient(baseURL: "https://api.fern.com") - _ = try await client.completions.streamEventsContextProtocol(request: .init(query: "query")) + _ = try await client.completions.streamEventsDiscriminantInData(request: .init(query: "query")) } try await main() diff --git a/seed/swift-sdk/server-sent-event-examples/Snippets/Example9.swift b/seed/swift-sdk/server-sent-event-examples/Snippets/Example9.swift index ba0611335f06..59e82c1da9ca 100644 --- a/seed/swift-sdk/server-sent-event-examples/Snippets/Example9.swift +++ b/seed/swift-sdk/server-sent-event-examples/Snippets/Example9.swift @@ -4,7 +4,7 @@ import ServerSentEvents private func main() async throws { let client = ServerSentEventsClient(baseURL: "https://api.fern.com") - _ = try await client.completions.streamEventsContextProtocol(request: .init(query: "")) + _ = try await client.completions.streamEventsDiscriminantInData(request: .init(query: "query")) } try await main() diff --git a/seed/swift-sdk/server-sent-event-examples/Sources/Requests/Requests+StreamEventsDiscriminantInDataRequest.swift b/seed/swift-sdk/server-sent-event-examples/Sources/Requests/Requests+StreamEventsDiscriminantInDataRequest.swift new file mode 100644 index 000000000000..7e1ed8911180 --- /dev/null +++ b/seed/swift-sdk/server-sent-event-examples/Sources/Requests/Requests+StreamEventsDiscriminantInDataRequest.swift @@ -0,0 +1,34 @@ +import Foundation + +extension Requests { + public struct StreamEventsDiscriminantInDataRequest: Codable, Hashable, Sendable { + public let query: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + query: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.query = query + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.query = try container.decode(String.self, forKey: .query) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.query, forKey: .query) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case query + } + } +} \ No newline at end of file diff --git a/seed/swift-sdk/server-sent-event-examples/Sources/Resources/Completions/CompletionsClient.swift b/seed/swift-sdk/server-sent-event-examples/Sources/Resources/Completions/CompletionsClient.swift index d7e6af6d35c1..5badd2af2b66 100644 --- a/seed/swift-sdk/server-sent-event-examples/Sources/Resources/Completions/CompletionsClient.swift +++ b/seed/swift-sdk/server-sent-event-examples/Sources/Resources/Completions/CompletionsClient.swift @@ -27,6 +27,16 @@ public final class CompletionsClient: Sendable { ) } + public func streamEventsDiscriminantInData(request: Requests.StreamEventsDiscriminantInDataRequest, requestOptions: RequestOptions? = nil) async throws -> JSONValue { + return try await httpClient.performRequest( + method: .post, + path: "/stream-events-discriminant-in-data", + body: request, + requestOptions: requestOptions, + responseType: JSONValue.self + ) + } + public func streamEventsContextProtocol(request: Requests.StreamEventsContextProtocolRequest, requestOptions: RequestOptions? = nil) async throws -> JSONValue { return try await httpClient.performRequest( method: .post, diff --git a/seed/swift-sdk/server-sent-event-examples/Sources/Schemas/GroupCreatedEvent.swift b/seed/swift-sdk/server-sent-event-examples/Sources/Schemas/GroupCreatedEvent.swift new file mode 100644 index 000000000000..06c3a38843fc --- /dev/null +++ b/seed/swift-sdk/server-sent-event-examples/Sources/Schemas/GroupCreatedEvent.swift @@ -0,0 +1,38 @@ +import Foundation + +public struct GroupCreatedEvent: Codable, Hashable, Sendable { + public let offset: String + public let groupId: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + offset: String, + groupId: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.offset = offset + self.groupId = groupId + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.offset = try container.decode(String.self, forKey: .offset) + self.groupId = try container.decode(String.self, forKey: .groupId) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.offset, forKey: .offset) + try container.encode(self.groupId, forKey: .groupId) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case offset + case groupId = "group_id" + } +} \ No newline at end of file diff --git a/seed/swift-sdk/server-sent-event-examples/Sources/Schemas/GroupDeletedEvent.swift b/seed/swift-sdk/server-sent-event-examples/Sources/Schemas/GroupDeletedEvent.swift new file mode 100644 index 000000000000..0cbb27daf3fe --- /dev/null +++ b/seed/swift-sdk/server-sent-event-examples/Sources/Schemas/GroupDeletedEvent.swift @@ -0,0 +1,38 @@ +import Foundation + +public struct GroupDeletedEvent: Codable, Hashable, Sendable { + public let offset: String + public let groupId: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + offset: String, + groupId: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.offset = offset + self.groupId = groupId + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.offset = try container.decode(String.self, forKey: .offset) + self.groupId = try container.decode(String.self, forKey: .groupId) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.offset, forKey: .offset) + try container.encode(self.groupId, forKey: .groupId) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case offset + case groupId = "group_id" + } +} \ No newline at end of file diff --git a/seed/swift-sdk/server-sent-event-examples/Sources/Schemas/StreamEventDiscriminantInData.swift b/seed/swift-sdk/server-sent-event-examples/Sources/Schemas/StreamEventDiscriminantInData.swift new file mode 100644 index 000000000000..25219ae1effc --- /dev/null +++ b/seed/swift-sdk/server-sent-event-examples/Sources/Schemas/StreamEventDiscriminantInData.swift @@ -0,0 +1,40 @@ +import Foundation + +public enum StreamEventDiscriminantInData: Codable, Hashable, Sendable { + case groupCreated(GroupCreatedEvent) + case groupDeleted(GroupDeletedEvent) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "group.created": + self = .groupCreated(try GroupCreatedEvent(from: decoder)) + case "group.deleted": + self = .groupDeleted(try GroupDeletedEvent(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .groupCreated(let data): + try container.encode("group.created", forKey: .type) + try data.encode(to: encoder) + case .groupDeleted(let data): + try container.encode("group.deleted", forKey: .type) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case type + } +} \ No newline at end of file diff --git a/seed/swift-sdk/server-sent-event-examples/reference.md b/seed/swift-sdk/server-sent-event-examples/reference.md index 29079804d7b6..7eadcebf3d95 100644 --- a/seed/swift-sdk/server-sent-event-examples/reference.md +++ b/seed/swift-sdk/server-sent-event-examples/reference.md @@ -110,6 +110,63 @@ try await main() + + + + +
client.completions.streamEventsDiscriminantInData(request: Requests.StreamEventsDiscriminantInDataRequest, requestOptions: RequestOptions?) -> JSONValue +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```swift +import Foundation +import ServerSentEvents + +private func main() async throws { + let client = ServerSentEventsClient() + + _ = try await client.completions.streamEventsDiscriminantInData(request: .init(query: "query")) +} + +try await main() +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Requests.StreamEventsDiscriminantInDataRequest` + +
+
+ +
+
+ +**requestOptions:** `RequestOptions?` — Additional options for configuring the request, such as custom headers or timeout settings. + +
+
+
+
+ +
From e02d3ce99a1dd8a717fe2f3fa20d4d5c5b07b268 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:57:24 -0400 Subject: [PATCH 27/43] chore(go): update go-sdk seed (#15575) Co-authored-by: patrickthornton <70873350+patrickthornton@users.noreply.github.com> --- .../with-wire-tests/completions.go | 363 ++++++++++++ .../with-wire-tests/completions/client.go | 39 ++ .../completions_test/completions_test.go | 25 + .../with-wire-tests/completions_test.go | 547 ++++++++++++++++++ .../dynamic-snippets/example10/snippet.go | 4 +- .../dynamic-snippets/example12/snippet.go | 24 + .../dynamic-snippets/example13/snippet.go | 24 + .../dynamic-snippets/example14/snippet.go | 24 + .../dynamic-snippets/example8/snippet.go | 4 +- .../dynamic-snippets/example9/snippet.go | 6 +- .../with-wire-tests/reference.md | 47 ++ .../with-wire-tests/snippet.json | 11 + .../wiremock/wiremock-mappings.json | 28 +- 13 files changed, 1138 insertions(+), 8 deletions(-) create mode 100644 seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example12/snippet.go create mode 100644 seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example13/snippet.go create mode 100644 seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example14/snippet.go diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions.go b/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions.go index 2f48f4c25fd4..dbc587554c0c 100644 --- a/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions.go +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions.go @@ -147,6 +147,52 @@ func (s *StreamEventsContextProtocolRequest) MarshalJSON() ([]byte, error) { return json.Marshal(explicitMarshaler) } +var ( + streamEventsDiscriminantInDataRequestFieldQuery = big.NewInt(1 << 0) +) + +type StreamEventsDiscriminantInDataRequest struct { + Query string `json:"query" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (s *StreamEventsDiscriminantInDataRequest) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetQuery sets the Query field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StreamEventsDiscriminantInDataRequest) SetQuery(query string) { + s.Query = query + s.require(streamEventsDiscriminantInDataRequestFieldQuery) +} + +func (s *StreamEventsDiscriminantInDataRequest) UnmarshalJSON(data []byte) error { + type unmarshaler StreamEventsDiscriminantInDataRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *s = StreamEventsDiscriminantInDataRequest(body) + return nil +} + +func (s *StreamEventsDiscriminantInDataRequest) MarshalJSON() ([]byte, error) { + type embed StreamEventsDiscriminantInDataRequest + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( completionEventFieldContent = big.NewInt(1 << 0) ) @@ -431,6 +477,206 @@ func (e *EventEvent) String() string { return fmt.Sprintf("%#v", e) } +var ( + groupCreatedEventFieldOffset = big.NewInt(1 << 0) + groupCreatedEventFieldGroupID = big.NewInt(1 << 1) +) + +type GroupCreatedEvent struct { + Offset string `json:"offset" url:"offset"` + GroupID string `json:"group_id" url:"group_id"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GroupCreatedEvent) GetOffset() string { + if g == nil { + return "" + } + return g.Offset +} + +func (g *GroupCreatedEvent) GetGroupID() string { + if g == nil { + return "" + } + return g.GroupID +} + +func (g *GroupCreatedEvent) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GroupCreatedEvent) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetOffset sets the Offset field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GroupCreatedEvent) SetOffset(offset string) { + g.Offset = offset + g.require(groupCreatedEventFieldOffset) +} + +// SetGroupID sets the GroupID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GroupCreatedEvent) SetGroupID(groupID string) { + g.GroupID = groupID + g.require(groupCreatedEventFieldGroupID) +} + +func (g *GroupCreatedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler GroupCreatedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GroupCreatedEvent(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GroupCreatedEvent) MarshalJSON() ([]byte, error) { + type embed GroupCreatedEvent + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GroupCreatedEvent) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + groupDeletedEventFieldOffset = big.NewInt(1 << 0) + groupDeletedEventFieldGroupID = big.NewInt(1 << 1) +) + +type GroupDeletedEvent struct { + Offset string `json:"offset" url:"offset"` + GroupID string `json:"group_id" url:"group_id"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GroupDeletedEvent) GetOffset() string { + if g == nil { + return "" + } + return g.Offset +} + +func (g *GroupDeletedEvent) GetGroupID() string { + if g == nil { + return "" + } + return g.GroupID +} + +func (g *GroupDeletedEvent) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GroupDeletedEvent) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetOffset sets the Offset field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GroupDeletedEvent) SetOffset(offset string) { + g.Offset = offset + g.require(groupDeletedEventFieldOffset) +} + +// SetGroupID sets the GroupID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GroupDeletedEvent) SetGroupID(groupID string) { + g.GroupID = groupID + g.require(groupDeletedEventFieldGroupID) +} + +func (g *GroupDeletedEvent) UnmarshalJSON(data []byte) error { + type unmarshaler GroupDeletedEvent + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GroupDeletedEvent(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GroupDeletedEvent) MarshalJSON() ([]byte, error) { + type embed GroupDeletedEvent + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GroupDeletedEvent) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + type StreamEvent struct { Event string Completion *CompletionEvent @@ -689,6 +935,123 @@ func (s *StreamEventContextProtocol) validate() error { return nil } +type StreamEventDiscriminantInData struct { + Type string + GroupCreated *GroupCreatedEvent + GroupDeleted *GroupDeletedEvent +} + +func (s *StreamEventDiscriminantInData) GetType() string { + if s == nil { + return "" + } + return s.Type +} + +func (s *StreamEventDiscriminantInData) GetGroupCreated() *GroupCreatedEvent { + if s == nil { + return nil + } + return s.GroupCreated +} + +func (s *StreamEventDiscriminantInData) GetGroupDeleted() *GroupDeletedEvent { + if s == nil { + return nil + } + return s.GroupDeleted +} + +func (s *StreamEventDiscriminantInData) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + s.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", s) + } + switch unmarshaler.Type { + case "group.created": + value := new(GroupCreatedEvent) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.GroupCreated = value + case "group.deleted": + value := new(GroupDeletedEvent) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.GroupDeleted = value + } + return nil +} + +func (s StreamEventDiscriminantInData) MarshalJSON() ([]byte, error) { + if err := s.validate(); err != nil { + return nil, err + } + if s.GroupCreated != nil { + return internal.MarshalJSONWithExtraProperty(s.GroupCreated, "type", "group.created") + } + if s.GroupDeleted != nil { + return internal.MarshalJSONWithExtraProperty(s.GroupDeleted, "type", "group.deleted") + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", s) +} + +type StreamEventDiscriminantInDataVisitor interface { + VisitGroupCreated(*GroupCreatedEvent) error + VisitGroupDeleted(*GroupDeletedEvent) error +} + +func (s *StreamEventDiscriminantInData) Accept(visitor StreamEventDiscriminantInDataVisitor) error { + if s.GroupCreated != nil { + return visitor.VisitGroupCreated(s.GroupCreated) + } + if s.GroupDeleted != nil { + return visitor.VisitGroupDeleted(s.GroupDeleted) + } + return fmt.Errorf("type %T does not define a non-empty union type", s) +} + +func (s *StreamEventDiscriminantInData) validate() error { + if s == nil { + return fmt.Errorf("type %T is nil", s) + } + var fields []string + if s.GroupCreated != nil { + fields = append(fields, "group.created") + } + if s.GroupDeleted != nil { + fields = append(fields, "group.deleted") + } + if len(fields) == 0 { + if s.Type != "" { + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", s, s.Type) + } + return fmt.Errorf("type %T is empty", s) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", s, fields) + } + if s.Type != "" { + field := fields[0] + if s.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + s, + s.Type, + s, + ) + } + } + return nil +} + var ( streamedCompletionFieldDelta = big.NewInt(1 << 0) streamedCompletionFieldTokens = big.NewInt(1 << 1) diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions/client.go b/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions/client.go index 2b0ad48294b6..d5f9a814d36b 100644 --- a/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions/client.go +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions/client.go @@ -110,6 +110,45 @@ func (c *Client) StreamEvents( ) } +func (c *Client) StreamEventsDiscriminantInData( + ctx context.Context, + request *sse.StreamEventsDiscriminantInDataRequest, + opts ...option.RequestOption, +) (*core.Stream[sse.StreamEventDiscriminantInData], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "", + ) + endpointURL := baseURL + "/stream-events-discriminant-in-data" + headers := internal.MergeHeaders( + c.options.ToHeader(), + options.ToHeader(), + ) + headers.Add("Accept", "text/event-stream") + streamer := internal.NewStreamer[sse.StreamEventDiscriminantInData](c.caller) + return streamer.Stream( + ctx, + &internal.StreamParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + MaxBufSize: options.MaxBufSize, + Prefix: internal.DefaultSSEDataPrefix, + Terminator: internal.DefaultSSETerminator, + Format: core.StreamFormatSSE, + EventDiscriminator: "type", + Request: request, + ErrorDecoder: internal.NewErrorDecoder(sse.ErrorCodes), + }, + ) +} + func (c *Client) StreamEventsContextProtocol( ctx context.Context, request *sse.StreamEventsContextProtocolRequest, diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions/completions_test/completions_test.go b/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions/completions_test/completions_test.go index 10376bd1ca1b..ef6dc5ff1f4f 100644 --- a/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions/completions_test/completions_test.go +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions/completions_test/completions_test.go @@ -127,6 +127,31 @@ func TestCompletionsStreamEventsWithWireMock( VerifyRequestCount(t, "TestCompletionsStreamEventsWithWireMock", "POST", "/stream-events", nil, 1) } +func TestCompletionsStreamEventsDiscriminantInDataWithWireMock( + t *testing.T, +) { + WireMockBaseURL := os.Getenv("WIREMOCK_URL") + if WireMockBaseURL == "" { + WireMockBaseURL = "http://localhost:8080" + } + client := client.NewClient( + option.WithBaseURL(WireMockBaseURL), + ) + request := &sse.StreamEventsDiscriminantInDataRequest{ + Query: "query", + } + _, invocationErr := client.Completions.StreamEventsDiscriminantInData( + context.TODO(), + request, + option.WithHTTPHeader( + http.Header{"X-Test-Id": []string{"TestCompletionsStreamEventsDiscriminantInDataWithWireMock"}}, + ), + ) + + require.NoError(t, invocationErr, "Client method call should succeed") + VerifyRequestCount(t, "TestCompletionsStreamEventsDiscriminantInDataWithWireMock", "POST", "/stream-events-discriminant-in-data", nil, 1) +} + func TestCompletionsStreamEventsContextProtocolWithWireMock( t *testing.T, ) { diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions_test.go b/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions_test.go index 42474a308c95..3010f5c53baf 100644 --- a/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions_test.go +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/completions_test.go @@ -144,6 +144,51 @@ func TestSettersMarkExplicitStreamEventsContextProtocolRequest(t *testing.T) { } +func TestSettersStreamEventsDiscriminantInDataRequest(t *testing.T) { + t.Run("SetQuery", func(t *testing.T) { + obj := &StreamEventsDiscriminantInDataRequest{} + var fernTestValueQuery string + obj.SetQuery(fernTestValueQuery) + assert.Equal(t, fernTestValueQuery, obj.Query) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestSettersMarkExplicitStreamEventsDiscriminantInDataRequest(t *testing.T) { + t.Run("SetQuery_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StreamEventsDiscriminantInDataRequest{} + var fernTestValueQuery string + + // Act + obj.SetQuery(fernTestValueQuery) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + func TestSettersCompletionEvent(t *testing.T) { t.Run("SetContent", func(t *testing.T) { obj := &CompletionEvent{} @@ -491,6 +536,272 @@ func TestSettersMarkExplicitEventEvent(t *testing.T) { } +func TestSettersGroupCreatedEvent(t *testing.T) { + t.Run("SetOffset", func(t *testing.T) { + obj := &GroupCreatedEvent{} + var fernTestValueOffset string + obj.SetOffset(fernTestValueOffset) + assert.Equal(t, fernTestValueOffset, obj.Offset) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetGroupID", func(t *testing.T) { + obj := &GroupCreatedEvent{} + var fernTestValueGroupID string + obj.SetGroupID(fernTestValueGroupID) + assert.Equal(t, fernTestValueGroupID, obj.GroupID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGroupCreatedEvent(t *testing.T) { + t.Run("GetOffset", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GroupCreatedEvent{} + var expected string + obj.Offset = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOffset(), "getter should return the property value") + }) + + t.Run("GetOffset_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GroupCreatedEvent + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOffset() // Should return zero value + }) + + t.Run("GetGroupID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GroupCreatedEvent{} + var expected string + obj.GroupID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGroupID(), "getter should return the property value") + }) + + t.Run("GetGroupID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GroupCreatedEvent + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGroupID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGroupCreatedEvent(t *testing.T) { + t.Run("SetOffset_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GroupCreatedEvent{} + var fernTestValueOffset string + + // Act + obj.SetOffset(fernTestValueOffset) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetGroupID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GroupCreatedEvent{} + var fernTestValueGroupID string + + // Act + obj.SetGroupID(fernTestValueGroupID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGroupDeletedEvent(t *testing.T) { + t.Run("SetOffset", func(t *testing.T) { + obj := &GroupDeletedEvent{} + var fernTestValueOffset string + obj.SetOffset(fernTestValueOffset) + assert.Equal(t, fernTestValueOffset, obj.Offset) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetGroupID", func(t *testing.T) { + obj := &GroupDeletedEvent{} + var fernTestValueGroupID string + obj.SetGroupID(fernTestValueGroupID) + assert.Equal(t, fernTestValueGroupID, obj.GroupID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGroupDeletedEvent(t *testing.T) { + t.Run("GetOffset", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GroupDeletedEvent{} + var expected string + obj.Offset = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOffset(), "getter should return the property value") + }) + + t.Run("GetOffset_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GroupDeletedEvent + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOffset() // Should return zero value + }) + + t.Run("GetGroupID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GroupDeletedEvent{} + var expected string + obj.GroupID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGroupID(), "getter should return the property value") + }) + + t.Run("GetGroupID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GroupDeletedEvent + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGroupID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGroupDeletedEvent(t *testing.T) { + t.Run("SetOffset_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GroupDeletedEvent{} + var fernTestValueOffset string + + // Act + obj.SetOffset(fernTestValueOffset) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetGroupID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GroupDeletedEvent{} + var fernTestValueGroupID string + + // Act + obj.SetGroupID(fernTestValueGroupID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + func TestGettersStreamEvent(t *testing.T) { t.Run("GetEvent", func(t *testing.T) { t.Parallel() @@ -708,6 +1019,98 @@ func TestGettersStreamEventContextProtocol(t *testing.T) { } +func TestGettersStreamEventDiscriminantInData(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StreamEventDiscriminantInData{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StreamEventDiscriminantInData + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetGroupCreated", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StreamEventDiscriminantInData{} + var expected *GroupCreatedEvent + obj.GroupCreated = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGroupCreated(), "getter should return the property value") + }) + + t.Run("GetGroupCreated_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StreamEventDiscriminantInData{} + obj.GroupCreated = nil + + // Act & Assert + assert.Nil(t, obj.GetGroupCreated(), "getter should return nil when property is nil") + }) + + t.Run("GetGroupCreated_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StreamEventDiscriminantInData + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGroupCreated() // Should return zero value + }) + + t.Run("GetGroupDeleted", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StreamEventDiscriminantInData{} + var expected *GroupDeletedEvent + obj.GroupDeleted = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGroupDeleted(), "getter should return the property value") + }) + + t.Run("GetGroupDeleted_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StreamEventDiscriminantInData{} + obj.GroupDeleted = nil + + // Act & Assert + assert.Nil(t, obj.GetGroupDeleted(), "getter should return nil when property is nil") + }) + + t.Run("GetGroupDeleted_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StreamEventDiscriminantInData + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGroupDeleted() // Should return zero value + }) + +} + func TestSettersStreamedCompletion(t *testing.T) { t.Run("SetDelta", func(t *testing.T) { obj := &StreamedCompletion{} @@ -950,6 +1353,72 @@ func TestJSONMarshalingEventEvent(t *testing.T) { }) } +func TestJSONMarshalingGroupCreatedEvent(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GroupCreatedEvent{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GroupCreatedEvent + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GroupCreatedEvent + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GroupCreatedEvent + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGroupDeletedEvent(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GroupDeletedEvent{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GroupDeletedEvent + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GroupDeletedEvent + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GroupDeletedEvent + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + func TestJSONMarshalingStreamedCompletion(t *testing.T) { t.Run("MarshalUnmarshal", func(t *testing.T) { t.Parallel() @@ -1031,6 +1500,38 @@ func TestStringEventEvent(t *testing.T) { }) } +func TestStringGroupCreatedEvent(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GroupCreatedEvent{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GroupCreatedEvent + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGroupDeletedEvent(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GroupDeletedEvent{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GroupDeletedEvent + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + func TestStringStreamedCompletion(t *testing.T) { t.Run("StringMethod", func(t *testing.T) { t.Parallel() @@ -1116,6 +1617,52 @@ func TestExtraPropertiesEventEvent(t *testing.T) { }) } +func TestExtraPropertiesGroupCreatedEvent(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GroupCreatedEvent{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GroupCreatedEvent + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGroupDeletedEvent(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GroupDeletedEvent{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GroupDeletedEvent + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + func TestExtraPropertiesStreamedCompletion(t *testing.T) { t.Run("GetExtraProperties", func(t *testing.T) { t.Parallel() diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example10/snippet.go b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example10/snippet.go index 555ece253749..aa0a89c0f29f 100644 --- a/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example10/snippet.go +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example10/snippet.go @@ -14,10 +14,10 @@ func do() { "https://api.fern.com", ), ) - request := &sse.StreamEventsContextProtocolRequest{ + request := &sse.StreamEventsDiscriminantInDataRequest{ Query: "query", } - client.Completions.StreamEventsContextProtocol( + client.Completions.StreamEventsDiscriminantInData( context.TODO(), request, ) diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example12/snippet.go b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example12/snippet.go new file mode 100644 index 000000000000..bdcefda7df02 --- /dev/null +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example12/snippet.go @@ -0,0 +1,24 @@ +package example + +import ( + context "context" + + sse "github.com/fern-api/sse-examples-go" + client "github.com/fern-api/sse-examples-go/client" + option "github.com/fern-api/sse-examples-go/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + ) + request := &sse.StreamEventsContextProtocolRequest{ + Query: "", + } + client.Completions.StreamEventsContextProtocol( + context.TODO(), + request, + ) +} diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example13/snippet.go b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example13/snippet.go new file mode 100644 index 000000000000..555ece253749 --- /dev/null +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example13/snippet.go @@ -0,0 +1,24 @@ +package example + +import ( + context "context" + + sse "github.com/fern-api/sse-examples-go" + client "github.com/fern-api/sse-examples-go/client" + option "github.com/fern-api/sse-examples-go/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + ) + request := &sse.StreamEventsContextProtocolRequest{ + Query: "query", + } + client.Completions.StreamEventsContextProtocol( + context.TODO(), + request, + ) +} diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example14/snippet.go b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example14/snippet.go new file mode 100644 index 000000000000..555ece253749 --- /dev/null +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example14/snippet.go @@ -0,0 +1,24 @@ +package example + +import ( + context "context" + + sse "github.com/fern-api/sse-examples-go" + client "github.com/fern-api/sse-examples-go/client" + option "github.com/fern-api/sse-examples-go/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + ) + request := &sse.StreamEventsContextProtocolRequest{ + Query: "query", + } + client.Completions.StreamEventsContextProtocol( + context.TODO(), + request, + ) +} diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example8/snippet.go b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example8/snippet.go index 555ece253749..aa0a89c0f29f 100644 --- a/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example8/snippet.go +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example8/snippet.go @@ -14,10 +14,10 @@ func do() { "https://api.fern.com", ), ) - request := &sse.StreamEventsContextProtocolRequest{ + request := &sse.StreamEventsDiscriminantInDataRequest{ Query: "query", } - client.Completions.StreamEventsContextProtocol( + client.Completions.StreamEventsDiscriminantInData( context.TODO(), request, ) diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example9/snippet.go b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example9/snippet.go index bdcefda7df02..aa0a89c0f29f 100644 --- a/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example9/snippet.go +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example9/snippet.go @@ -14,10 +14,10 @@ func do() { "https://api.fern.com", ), ) - request := &sse.StreamEventsContextProtocolRequest{ - Query: "", + request := &sse.StreamEventsDiscriminantInDataRequest{ + Query: "query", } - client.Completions.StreamEventsContextProtocol( + client.Completions.StreamEventsDiscriminantInData( context.TODO(), request, ) diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/reference.md b/seed/go-sdk/server-sent-event-examples/with-wire-tests/reference.md index 33a5b8758f68..fcecc6192247 100644 --- a/seed/go-sdk/server-sent-event-examples/with-wire-tests/reference.md +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/reference.md @@ -90,6 +90,53 @@ client.Completions.StreamEvents( + + + + +
client.Completions.StreamEventsDiscriminantInData(request) -> sse.StreamEventDiscriminantInData +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &sse.StreamEventsDiscriminantInDataRequest{ + Query: "query", + } +client.Completions.StreamEventsDiscriminantInData( + context.TODO(), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**query:** `string` + +
+
+
+
+ +
diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/snippet.json b/seed/go-sdk/server-sent-event-examples/with-wire-tests/snippet.json index 21b25f0ba2d6..adab2aed6d92 100644 --- a/seed/go-sdk/server-sent-event-examples/with-wire-tests/snippet.json +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/snippet.json @@ -11,6 +11,17 @@ "client": "import (\n\tcontext \"context\"\n\tsseexamplesgo \"github.com/fern-api/sse-examples-go\"\n\tsseexamplesgoclient \"github.com/fern-api/sse-examples-go/client\"\n)\n\nclient := sseexamplesgoclient.NewClient()\nresponse, err := client.Completions.StreamEventsContextProtocol(\n\tcontext.TODO(),\n\t\u0026sseexamplesgo.StreamEventsContextProtocolRequest{\n\t\tQuery: \"query\",\n\t},\n)\n" } }, + { + "id": { + "path": "/stream-events-discriminant-in-data", + "method": "POST", + "identifier_override": "endpoint_completions.streamEventsDiscriminantInData" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tsseexamplesgo \"github.com/fern-api/sse-examples-go\"\n\tsseexamplesgoclient \"github.com/fern-api/sse-examples-go/client\"\n)\n\nclient := sseexamplesgoclient.NewClient()\nresponse, err := client.Completions.StreamEventsDiscriminantInData(\n\tcontext.TODO(),\n\t\u0026sseexamplesgo.StreamEventsDiscriminantInDataRequest{\n\t\tQuery: \"query\",\n\t},\n)\n" + } + }, { "id": { "path": "/stream-events", diff --git a/seed/go-sdk/server-sent-event-examples/with-wire-tests/wiremock/wiremock-mappings.json b/seed/go-sdk/server-sent-event-examples/with-wire-tests/wiremock/wiremock-mappings.json index ba96c5a10dfc..cc257505a389 100644 --- a/seed/go-sdk/server-sent-event-examples/with-wire-tests/wiremock/wiremock-mappings.json +++ b/seed/go-sdk/server-sent-event-examples/with-wire-tests/wiremock/wiremock-mappings.json @@ -52,6 +52,32 @@ } } }, + { + "id": "b9c132a6-4cb0-462f-a27c-c8c4c9a457d4", + "name": "streamEventsDiscriminantInData - Stream events where discriminant is embedded in data and SSE event line is empty", + "request": { + "urlPathTemplate": "/stream-events-discriminant-in-data", + "method": "POST" + }, + "response": { + "status": 200, + "body": "event: message\ndata: {\"type\":\"group.created\",\"offset\":\"offset-1\",\"group_id\":\"g1\"}\n\nevent: message\ndata: {\"type\":\"group.deleted\",\"offset\":\"offset-2\",\"group_id\":\"g2\"}\n", + "headers": { + "Content-Type": "text/event-stream" + } + }, + "uuid": "b9c132a6-4cb0-462f-a27c-c8c4c9a457d4", + "persistent": true, + "priority": 3, + "metadata": { + "mocklab": { + "created": { + "at": "2020-01-01T00:00:00.000Z", + "via": "SYSTEM" + } + } + } + }, { "id": "0913bb86-4b39-4c8a-9875-111a5210a147", "name": "streamEventsContextProtocol - Stream events context protocol", @@ -80,6 +106,6 @@ } ], "meta": { - "total": 3 + "total": 4 } } \ No newline at end of file From d2585aeaf685af83c72be55cc543638b3dd21233 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:57:28 -0400 Subject: [PATCH 28/43] chore(rust): update rust-sdk seed (#15579) Co-authored-by: patrickthornton <70873350+patrickthornton@users.noreply.github.com> --- .../dynamic-snippets/example10.rs | 4 +- .../dynamic-snippets/example12.rs | 19 +++++++ .../dynamic-snippets/example13.rs | 19 +++++++ .../dynamic-snippets/example14.rs | 19 +++++++ .../dynamic-snippets/example8.rs | 4 +- .../dynamic-snippets/example9.rs | 6 +- .../with-wire-tests/reference.md | 57 +++++++++++++++++++ .../api/resources/completions/completions.rs | 17 ++++++ ...tions_stream_event_discriminant_in_data.rs | 33 +++++++++++ .../with-wire-tests/src/api/types/mod.rs | 4 ++ ...eam_events_discriminant_in_data_request.rs | 37 ++++++++++++ .../with-wire-tests/tests/completions_test.rs | 30 ++++++++++ .../wiremock/wiremock-mappings.json | 28 ++++++++- 13 files changed, 269 insertions(+), 8 deletions(-) create mode 100644 seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example12.rs create mode 100644 seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example13.rs create mode 100644 seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example14.rs create mode 100644 seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/completions_stream_event_discriminant_in_data.rs create mode 100644 seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/stream_events_discriminant_in_data_request.rs diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example10.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example10.rs index 5f0854192fba..d876af1d1342 100644 --- a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example10.rs +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example10.rs @@ -9,8 +9,8 @@ async fn main() { let client = ServerSentEventsClient::new(config).expect("Failed to build client"); client .completions - .stream_events_context_protocol( - &StreamEventsContextProtocolRequest { + .stream_events_discriminant_in_data( + &StreamEventsDiscriminantInDataRequest { query: "query".to_string(), }, None, diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example12.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example12.rs new file mode 100644 index 000000000000..46c48585d682 --- /dev/null +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example12.rs @@ -0,0 +1,19 @@ +use seed_server_sent_events::prelude::*; + +#[tokio::main] +async fn main() { + let config = ClientConfig { + base_url: "https://api.fern.com".to_string(), + ..Default::default() + }; + let client = ServerSentEventsClient::new(config).expect("Failed to build client"); + client + .completions + .stream_events_context_protocol( + &StreamEventsContextProtocolRequest { + query: "".to_string(), + }, + None, + ) + .await; +} diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example13.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example13.rs new file mode 100644 index 000000000000..5f0854192fba --- /dev/null +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example13.rs @@ -0,0 +1,19 @@ +use seed_server_sent_events::prelude::*; + +#[tokio::main] +async fn main() { + let config = ClientConfig { + base_url: "https://api.fern.com".to_string(), + ..Default::default() + }; + let client = ServerSentEventsClient::new(config).expect("Failed to build client"); + client + .completions + .stream_events_context_protocol( + &StreamEventsContextProtocolRequest { + query: "query".to_string(), + }, + None, + ) + .await; +} diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example14.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example14.rs new file mode 100644 index 000000000000..5f0854192fba --- /dev/null +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example14.rs @@ -0,0 +1,19 @@ +use seed_server_sent_events::prelude::*; + +#[tokio::main] +async fn main() { + let config = ClientConfig { + base_url: "https://api.fern.com".to_string(), + ..Default::default() + }; + let client = ServerSentEventsClient::new(config).expect("Failed to build client"); + client + .completions + .stream_events_context_protocol( + &StreamEventsContextProtocolRequest { + query: "query".to_string(), + }, + None, + ) + .await; +} diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example8.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example8.rs index 5f0854192fba..d876af1d1342 100644 --- a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example8.rs +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example8.rs @@ -9,8 +9,8 @@ async fn main() { let client = ServerSentEventsClient::new(config).expect("Failed to build client"); client .completions - .stream_events_context_protocol( - &StreamEventsContextProtocolRequest { + .stream_events_discriminant_in_data( + &StreamEventsDiscriminantInDataRequest { query: "query".to_string(), }, None, diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example9.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example9.rs index 46c48585d682..d876af1d1342 100644 --- a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example9.rs +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/dynamic-snippets/example9.rs @@ -9,9 +9,9 @@ async fn main() { let client = ServerSentEventsClient::new(config).expect("Failed to build client"); client .completions - .stream_events_context_protocol( - &StreamEventsContextProtocolRequest { - query: "".to_string(), + .stream_events_discriminant_in_data( + &StreamEventsDiscriminantInDataRequest { + query: "query".to_string(), }, None, ) diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/reference.md b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/reference.md index 05d6679cf6ff..c17505bedb03 100644 --- a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/reference.md +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/reference.md @@ -110,6 +110,63 @@ async fn main() { + + + + +
client.completions.stream_events_discriminant_in_data(request: StreamEventsDiscriminantInDataRequest) -> Result<Stream<Vec<u8>>, ApiError> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```rust +use seed_server_sent_events::prelude::*; + +#[tokio::main] +async fn main() { + let config = ClientConfig { + ..Default::default() + }; + let client = ServerSentEventsClient::new(config).expect("Failed to build client"); + client + .completions + .stream_events_discriminant_in_data( + &StreamEventsDiscriminantInDataRequest { + query: "query".to_string(), + }, + None, + ) + .await; +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**query:** `String` + +
+
+
+
+ +
diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/resources/completions/completions.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/resources/completions/completions.rs index 33b692ed5ce0..50502c3a0410 100644 --- a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/resources/completions/completions.rs +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/resources/completions/completions.rs @@ -47,6 +47,23 @@ impl CompletionsClient { .await } + pub async fn stream_events_discriminant_in_data( + &self, + request: &StreamEventsDiscriminantInDataRequest, + options: Option, + ) -> Result, ApiError> { + self.http_client + .execute_sse_request( + Method::POST, + "stream-events-discriminant-in-data", + Some(serde_json::to_value(request).map_err(ApiError::Serialization)?), + None, + options, + None, + ) + .await + } + pub async fn stream_events_context_protocol( &self, request: &StreamEventsContextProtocolRequest, diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/completions_stream_event_discriminant_in_data.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/completions_stream_event_discriminant_in_data.rs new file mode 100644 index 000000000000..da93310960d2 --- /dev/null +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/completions_stream_event_discriminant_in_data.rs @@ -0,0 +1,33 @@ +pub use crate::prelude::*; + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)] +#[serde(tag = "type")] +pub enum StreamEventDiscriminantInData { + #[serde(rename = "group.created")] + #[non_exhaustive] + GroupCreated { + #[serde(default)] + offset: String, + #[serde(default)] + group_id: String, + }, + + #[serde(rename = "group.deleted")] + #[non_exhaustive] + GroupDeleted { + #[serde(default)] + offset: String, + #[serde(default)] + group_id: String, + }, +} + +impl StreamEventDiscriminantInData { + pub fn group_created(offset: String, group_id: String) -> Self { + Self::GroupCreated { offset, group_id } + } + + pub fn group_deleted(offset: String, group_id: String) -> Self { + Self::GroupDeleted { offset, group_id } + } +} diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/mod.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/mod.rs index 766809d157d8..b06f5f2a1d77 100644 --- a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/mod.rs +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/mod.rs @@ -2,16 +2,20 @@ pub mod completions_completion_event; pub mod completions_error_event; pub mod completions_stream_event; pub mod completions_stream_event_context_protocol; +pub mod completions_stream_event_discriminant_in_data; pub mod completions_streamed_completion; pub mod stream_completion_request; pub mod stream_events_context_protocol_request; +pub mod stream_events_discriminant_in_data_request; pub mod stream_events_request; pub use completions_completion_event::CompletionEvent; pub use completions_error_event::ErrorEvent; pub use completions_stream_event::StreamEvent; pub use completions_stream_event_context_protocol::StreamEventContextProtocol; +pub use completions_stream_event_discriminant_in_data::StreamEventDiscriminantInData; pub use completions_streamed_completion::StreamedCompletion; pub use stream_completion_request::StreamCompletionRequest; pub use stream_events_context_protocol_request::StreamEventsContextProtocolRequest; +pub use stream_events_discriminant_in_data_request::StreamEventsDiscriminantInDataRequest; pub use stream_events_request::StreamEventsRequest; diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/stream_events_discriminant_in_data_request.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/stream_events_discriminant_in_data_request.rs new file mode 100644 index 000000000000..59a45d48cfc6 --- /dev/null +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/src/api/types/stream_events_discriminant_in_data_request.rs @@ -0,0 +1,37 @@ +pub use crate::prelude::*; + +#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq, Hash)] +pub struct StreamEventsDiscriminantInDataRequest { + #[serde(default)] + pub query: String, +} + +impl StreamEventsDiscriminantInDataRequest { + pub fn builder() -> StreamEventsDiscriminantInDataRequestBuilder { + ::default() + } +} + +#[derive(Clone, PartialEq, Default, Debug)] +#[non_exhaustive] +pub struct StreamEventsDiscriminantInDataRequestBuilder { + query: Option, +} + +impl StreamEventsDiscriminantInDataRequestBuilder { + pub fn query(mut self, value: impl Into) -> Self { + self.query = Some(value.into()); + self + } + + /// Consumes the builder and constructs a [`StreamEventsDiscriminantInDataRequest`]. + /// This method will fail if any of the following fields are not set: + /// - [`query`](StreamEventsDiscriminantInDataRequestBuilder::query) + pub fn build(self) -> Result { + Ok(StreamEventsDiscriminantInDataRequest { + query: self + .query + .ok_or_else(|| BuildError::missing_field("query"))?, + }) + } +} diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/tests/completions_test.rs b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/tests/completions_test.rs index 02187f3d6332..184254df5c10 100644 --- a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/tests/completions_test.rs +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/tests/completions_test.rs @@ -62,6 +62,36 @@ async fn test_completions_stream_events_with_wiremock() { .unwrap(); } +#[tokio::test] +#[allow(unused_variables, unreachable_code)] +async fn test_completions_stream_events_discriminant_in_data_with_wiremock() { + wire_test_utils::reset_wiremock_requests().await.unwrap(); + let wiremock_base_url = wire_test_utils::get_wiremock_base_url(); + + let mut config = ClientConfig { + ..Default::default() + }; + config.base_url = wiremock_base_url.to_string(); + config.environment = None; + let client = ServerSentEventsClient::new(config).expect("Failed to build client"); + + let result = client + .completions + .stream_events_discriminant_in_data( + &StreamEventsDiscriminantInDataRequest { + query: "query".to_string(), + }, + None, + ) + .await; + + assert!(result.is_ok(), "Client method call should succeed"); + + wire_test_utils::verify_request_count("POST", "/stream-events-discriminant-in-data", None, 1) + .await + .unwrap(); +} + #[tokio::test] #[allow(unused_variables, unreachable_code)] async fn test_completions_stream_events_context_protocol_with_wiremock() { diff --git a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/wiremock/wiremock-mappings.json b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/wiremock/wiremock-mappings.json index ba96c5a10dfc..cc257505a389 100644 --- a/seed/rust-sdk/server-sent-event-examples/with-wire-tests/wiremock/wiremock-mappings.json +++ b/seed/rust-sdk/server-sent-event-examples/with-wire-tests/wiremock/wiremock-mappings.json @@ -52,6 +52,32 @@ } } }, + { + "id": "b9c132a6-4cb0-462f-a27c-c8c4c9a457d4", + "name": "streamEventsDiscriminantInData - Stream events where discriminant is embedded in data and SSE event line is empty", + "request": { + "urlPathTemplate": "/stream-events-discriminant-in-data", + "method": "POST" + }, + "response": { + "status": 200, + "body": "event: message\ndata: {\"type\":\"group.created\",\"offset\":\"offset-1\",\"group_id\":\"g1\"}\n\nevent: message\ndata: {\"type\":\"group.deleted\",\"offset\":\"offset-2\",\"group_id\":\"g2\"}\n", + "headers": { + "Content-Type": "text/event-stream" + } + }, + "uuid": "b9c132a6-4cb0-462f-a27c-c8c4c9a457d4", + "persistent": true, + "priority": 3, + "metadata": { + "mocklab": { + "created": { + "at": "2020-01-01T00:00:00.000Z", + "via": "SYSTEM" + } + } + } + }, { "id": "0913bb86-4b39-4c8a-9875-111a5210a147", "name": "streamEventsContextProtocol - Stream events context protocol", @@ -80,6 +106,6 @@ } ], "meta": { - "total": 3 + "total": 4 } } \ No newline at end of file From 1a63536fe55b31b7c603bdcae4950e58e1edd370 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 12:57:36 -0400 Subject: [PATCH 29/43] chore(ruby): update ruby-sdk-v2 seed (#15577) Co-authored-by: patrickthornton <70873350+patrickthornton@users.noreply.github.com> --- .../dynamic-snippets/example10/snippet.rb | 2 +- .../dynamic-snippets/example12/snippet.rb | 5 ++ .../dynamic-snippets/example13/snippet.rb | 5 ++ .../dynamic-snippets/example14/snippet.rb | 5 ++ .../dynamic-snippets/example8/snippet.rb | 2 +- .../dynamic-snippets/example9/snippet.rb | 2 +- .../server-sent-event-examples/lib/seed.rb | 4 ++ .../lib/seed/completions/client.rb | 30 ++++++++++++ .../completions/types/group_created_event.rb | 13 +++++ .../completions/types/group_deleted_event.rb | 13 +++++ .../stream_event_discriminant_in_data.rb | 17 +++++++ ...eam_events_discriminant_in_data_request.rb | 11 +++++ .../server-sent-event-examples/reference.md | 48 +++++++++++++++++++ 13 files changed, 154 insertions(+), 3 deletions(-) create mode 100644 seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example12/snippet.rb create mode 100644 seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example13/snippet.rb create mode 100644 seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example14/snippet.rb create mode 100644 seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/group_created_event.rb create mode 100644 seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/group_deleted_event.rb create mode 100644 seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/stream_event_discriminant_in_data.rb create mode 100644 seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/stream_events_discriminant_in_data_request.rb diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example10/snippet.rb b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example10/snippet.rb index e0eebe6a91d6..b6ccba67fb0d 100644 --- a/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example10/snippet.rb +++ b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example10/snippet.rb @@ -2,4 +2,4 @@ client = Seed::Client.new(base_url: "https://api.fern.com") -client.completions.stream_events_context_protocol(query: "query") +client.completions.stream_events_discriminant_in_data(query: "query") diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example12/snippet.rb b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example12/snippet.rb new file mode 100644 index 000000000000..808a79a364ab --- /dev/null +++ b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example12/snippet.rb @@ -0,0 +1,5 @@ +require "seed" + +client = Seed::Client.new(base_url: "https://api.fern.com") + +client.completions.stream_events_context_protocol(query: "") diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example13/snippet.rb b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example13/snippet.rb new file mode 100644 index 000000000000..e0eebe6a91d6 --- /dev/null +++ b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example13/snippet.rb @@ -0,0 +1,5 @@ +require "seed" + +client = Seed::Client.new(base_url: "https://api.fern.com") + +client.completions.stream_events_context_protocol(query: "query") diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example14/snippet.rb b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example14/snippet.rb new file mode 100644 index 000000000000..e0eebe6a91d6 --- /dev/null +++ b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example14/snippet.rb @@ -0,0 +1,5 @@ +require "seed" + +client = Seed::Client.new(base_url: "https://api.fern.com") + +client.completions.stream_events_context_protocol(query: "query") diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example8/snippet.rb b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example8/snippet.rb index e0eebe6a91d6..b6ccba67fb0d 100644 --- a/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example8/snippet.rb +++ b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example8/snippet.rb @@ -2,4 +2,4 @@ client = Seed::Client.new(base_url: "https://api.fern.com") -client.completions.stream_events_context_protocol(query: "query") +client.completions.stream_events_discriminant_in_data(query: "query") diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example9/snippet.rb b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example9/snippet.rb index 808a79a364ab..b6ccba67fb0d 100644 --- a/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example9/snippet.rb +++ b/seed/ruby-sdk-v2/server-sent-event-examples/dynamic-snippets/example9/snippet.rb @@ -2,4 +2,4 @@ client = Seed::Client.new(base_url: "https://api.fern.com") -client.completions.stream_events_context_protocol(query: "") +client.completions.stream_events_discriminant_in_data(query: "query") diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed.rb b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed.rb index 6e5f5113fdd2..2597cc3f51e4 100644 --- a/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed.rb +++ b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed.rb @@ -40,9 +40,13 @@ require_relative "seed/completions/types/event_event" require_relative "seed/completions/types/error_event" require_relative "seed/completions/types/stream_event_context_protocol" +require_relative "seed/completions/types/group_created_event" +require_relative "seed/completions/types/group_deleted_event" +require_relative "seed/completions/types/stream_event_discriminant_in_data" require_relative "seed/completions/types/stream_event" require_relative "seed/completions/client" require_relative "seed/completions/types/stream_completion_request" require_relative "seed/completions/types/stream_events_request" +require_relative "seed/completions/types/stream_events_discriminant_in_data_request" require_relative "seed/completions/types/stream_events_context_protocol_request" require_relative "seed/client" diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/client.rb b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/client.rb index ceb89a614ba2..0d74c4c6d5db 100644 --- a/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/client.rb +++ b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/client.rb @@ -70,6 +70,36 @@ def stream_events(request_options: {}, **params) raise error_class.new(response.body, code: code) end + # @param request_options [Hash] + # @param params [Seed::Completions::Types::StreamEventsDiscriminantInDataRequest] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # + # @return [untyped] + def stream_events_discriminant_in_data(request_options: {}, **params) + params = Seed::Internal::Types::Utils.normalize_keys(params) + request = Seed::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "POST", + path: "stream-events-discriminant-in-data", + body: Seed::Completions::Types::StreamEventsDiscriminantInDataRequest.new(params).to_h, + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Seed::Errors::TimeoutError + end + code = response.code.to_i + return if code.between?(200, 299) + + error_class = Seed::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + # @param request_options [Hash] # @param params [Seed::Completions::Types::StreamEventsContextProtocolRequest] # @option request_options [String] :base_url diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/group_created_event.rb b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/group_created_event.rb new file mode 100644 index 000000000000..2c4a348b293a --- /dev/null +++ b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/group_created_event.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Seed + module Completions + module Types + class GroupCreatedEvent < Internal::Types::Model + field :offset, -> { String }, optional: false, nullable: false + + field :group_id, -> { String }, optional: false, nullable: false + end + end + end +end diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/group_deleted_event.rb b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/group_deleted_event.rb new file mode 100644 index 000000000000..c33a4cbe8937 --- /dev/null +++ b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/group_deleted_event.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Seed + module Completions + module Types + class GroupDeletedEvent < Internal::Types::Model + field :offset, -> { String }, optional: false, nullable: false + + field :group_id, -> { String }, optional: false, nullable: false + end + end + end +end diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/stream_event_discriminant_in_data.rb b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/stream_event_discriminant_in_data.rb new file mode 100644 index 000000000000..89646c24710d --- /dev/null +++ b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/stream_event_discriminant_in_data.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Seed + module Completions + module Types + class StreamEventDiscriminantInData < Internal::Types::Model + extend Seed::Internal::Types::Union + + discriminant :type + + member -> { Seed::Completions::Types::GroupCreatedEvent }, key: "GROUP_CREATED" + + member -> { Seed::Completions::Types::GroupDeletedEvent }, key: "GROUP_DELETED" + end + end + end +end diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/stream_events_discriminant_in_data_request.rb b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/stream_events_discriminant_in_data_request.rb new file mode 100644 index 000000000000..f7a45d9cc81c --- /dev/null +++ b/seed/ruby-sdk-v2/server-sent-event-examples/lib/seed/completions/types/stream_events_discriminant_in_data_request.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Seed + module Completions + module Types + class StreamEventsDiscriminantInDataRequest < Internal::Types::Model + field :query, -> { String }, optional: false, nullable: false + end + end + end +end diff --git a/seed/ruby-sdk-v2/server-sent-event-examples/reference.md b/seed/ruby-sdk-v2/server-sent-event-examples/reference.md index 8125e4727df7..a1c341a9697d 100644 --- a/seed/ruby-sdk-v2/server-sent-event-examples/reference.md +++ b/seed/ruby-sdk-v2/server-sent-event-examples/reference.md @@ -92,6 +92,54 @@ client.completions.stream_events(query: "query") + + + + +
client.completions.stream_events_discriminant_in_data(request) -> Seed::Completions::Types::StreamEventDiscriminantInData +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.completions.stream_events_discriminant_in_data(query: "query") +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**query:** `String` + +
+
+ +
+
+ +**request_options:** `Seed::Completions::RequestOptions` + +
+
+
+
+ +
From a13d60ac529af1f560547ab64695af3d2b4b6c84 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 13:16:19 -0400 Subject: [PATCH 30/43] chore(java): update java-sdk seed (#15580) Co-authored-by: dsinghvi <10870189+dsinghvi@users.noreply.github.com> --- seed/java-sdk/nullable/no-custom-config/reference.md | 2 +- seed/java-sdk/nullable/no-custom-config/snippet.json | 4 ++-- .../no-custom-config/src/main/java/com/snippets/Example0.java | 3 +-- seed/java-sdk/nullable/wrapped-aliases/reference.md | 2 +- seed/java-sdk/nullable/wrapped-aliases/snippet.json | 4 ++-- .../wrapped-aliases/src/main/java/com/snippets/Example0.java | 3 +-- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/seed/java-sdk/nullable/no-custom-config/reference.md b/seed/java-sdk/nullable/no-custom-config/reference.md index 2f08e9e5a6fa..e2de156c1762 100644 --- a/seed/java-sdk/nullable/no-custom-config/reference.md +++ b/seed/java-sdk/nullable/no-custom-config/reference.md @@ -23,7 +23,7 @@ client.nullable().getUsers( Arrays.asList(true) ) .tags( - Arrays.asList(Optional.of("tags")) + Arrays.asList("tags") ) .avatar("avatar") .extra(true) diff --git a/seed/java-sdk/nullable/no-custom-config/snippet.json b/seed/java-sdk/nullable/no-custom-config/snippet.json index 95c0721602b7..696bc578ae0b 100644 --- a/seed/java-sdk/nullable/no-custom-config/snippet.json +++ b/seed/java-sdk/nullable/no-custom-config/snippet.json @@ -9,8 +9,8 @@ }, "snippet": { "type": "java", - "sync_client": "package com.example.usage;\n\nimport com.seed.nullable.SeedNullableClient;\nimport com.seed.nullable.resources.nullable.requests.GetUsersRequest;\nimport java.util.Arrays;\nimport java.util.Optional;\n\npublic class Example {\n public static void main(String[] args) {\n SeedNullableClient client = SeedNullableClient\n .builder()\n .build();\n\n client.nullable().getUsers(\n GetUsersRequest\n .builder()\n .usernames(\n Arrays.asList(\"usernames\")\n )\n .activated(\n Arrays.asList(true)\n )\n .tags(\n Arrays.asList(Optional.of(\"tags\"))\n )\n .avatar(\"avatar\")\n .extra(true)\n .build()\n );\n }\n}\n", - "async_client": "package com.example.usage;\n\nimport com.seed.nullable.SeedNullableClient;\nimport com.seed.nullable.resources.nullable.requests.GetUsersRequest;\nimport java.util.Arrays;\nimport java.util.Optional;\n\npublic class Example {\n public static void main(String[] args) {\n SeedNullableClient client = SeedNullableClient\n .builder()\n .build();\n\n client.nullable().getUsers(\n GetUsersRequest\n .builder()\n .usernames(\n Arrays.asList(\"usernames\")\n )\n .activated(\n Arrays.asList(true)\n )\n .tags(\n Arrays.asList(Optional.of(\"tags\"))\n )\n .avatar(\"avatar\")\n .extra(true)\n .build()\n );\n }\n}\n" + "sync_client": "package com.example.usage;\n\nimport com.seed.nullable.SeedNullableClient;\nimport com.seed.nullable.resources.nullable.requests.GetUsersRequest;\nimport java.util.Arrays;\n\npublic class Example {\n public static void main(String[] args) {\n SeedNullableClient client = SeedNullableClient\n .builder()\n .build();\n\n client.nullable().getUsers(\n GetUsersRequest\n .builder()\n .usernames(\n Arrays.asList(\"usernames\")\n )\n .activated(\n Arrays.asList(true)\n )\n .tags(\n Arrays.asList(\"tags\")\n )\n .avatar(\"avatar\")\n .extra(true)\n .build()\n );\n }\n}\n", + "async_client": "package com.example.usage;\n\nimport com.seed.nullable.SeedNullableClient;\nimport com.seed.nullable.resources.nullable.requests.GetUsersRequest;\nimport java.util.Arrays;\n\npublic class Example {\n public static void main(String[] args) {\n SeedNullableClient client = SeedNullableClient\n .builder()\n .build();\n\n client.nullable().getUsers(\n GetUsersRequest\n .builder()\n .usernames(\n Arrays.asList(\"usernames\")\n )\n .activated(\n Arrays.asList(true)\n )\n .tags(\n Arrays.asList(\"tags\")\n )\n .avatar(\"avatar\")\n .extra(true)\n .build()\n );\n }\n}\n" } }, { diff --git a/seed/java-sdk/nullable/no-custom-config/src/main/java/com/snippets/Example0.java b/seed/java-sdk/nullable/no-custom-config/src/main/java/com/snippets/Example0.java index 7ab5c0ea790b..c7bd7e02be17 100644 --- a/seed/java-sdk/nullable/no-custom-config/src/main/java/com/snippets/Example0.java +++ b/seed/java-sdk/nullable/no-custom-config/src/main/java/com/snippets/Example0.java @@ -3,7 +3,6 @@ import com.seed.nullable.SeedNullableClient; import com.seed.nullable.resources.nullable.requests.GetUsersRequest; import java.util.Arrays; -import java.util.Optional; public class Example0 { public static void main(String[] args) { @@ -14,7 +13,7 @@ public static void main(String[] args) { .getUsers(GetUsersRequest.builder() .usernames(Arrays.asList("usernames")) .activated(Arrays.asList(true)) - .tags(Arrays.asList(Optional.of("tags"))) + .tags(Arrays.asList("tags")) .avatar("avatar") .extra(true) .build()); diff --git a/seed/java-sdk/nullable/wrapped-aliases/reference.md b/seed/java-sdk/nullable/wrapped-aliases/reference.md index 2f08e9e5a6fa..e2de156c1762 100644 --- a/seed/java-sdk/nullable/wrapped-aliases/reference.md +++ b/seed/java-sdk/nullable/wrapped-aliases/reference.md @@ -23,7 +23,7 @@ client.nullable().getUsers( Arrays.asList(true) ) .tags( - Arrays.asList(Optional.of("tags")) + Arrays.asList("tags") ) .avatar("avatar") .extra(true) diff --git a/seed/java-sdk/nullable/wrapped-aliases/snippet.json b/seed/java-sdk/nullable/wrapped-aliases/snippet.json index 95c0721602b7..696bc578ae0b 100644 --- a/seed/java-sdk/nullable/wrapped-aliases/snippet.json +++ b/seed/java-sdk/nullable/wrapped-aliases/snippet.json @@ -9,8 +9,8 @@ }, "snippet": { "type": "java", - "sync_client": "package com.example.usage;\n\nimport com.seed.nullable.SeedNullableClient;\nimport com.seed.nullable.resources.nullable.requests.GetUsersRequest;\nimport java.util.Arrays;\nimport java.util.Optional;\n\npublic class Example {\n public static void main(String[] args) {\n SeedNullableClient client = SeedNullableClient\n .builder()\n .build();\n\n client.nullable().getUsers(\n GetUsersRequest\n .builder()\n .usernames(\n Arrays.asList(\"usernames\")\n )\n .activated(\n Arrays.asList(true)\n )\n .tags(\n Arrays.asList(Optional.of(\"tags\"))\n )\n .avatar(\"avatar\")\n .extra(true)\n .build()\n );\n }\n}\n", - "async_client": "package com.example.usage;\n\nimport com.seed.nullable.SeedNullableClient;\nimport com.seed.nullable.resources.nullable.requests.GetUsersRequest;\nimport java.util.Arrays;\nimport java.util.Optional;\n\npublic class Example {\n public static void main(String[] args) {\n SeedNullableClient client = SeedNullableClient\n .builder()\n .build();\n\n client.nullable().getUsers(\n GetUsersRequest\n .builder()\n .usernames(\n Arrays.asList(\"usernames\")\n )\n .activated(\n Arrays.asList(true)\n )\n .tags(\n Arrays.asList(Optional.of(\"tags\"))\n )\n .avatar(\"avatar\")\n .extra(true)\n .build()\n );\n }\n}\n" + "sync_client": "package com.example.usage;\n\nimport com.seed.nullable.SeedNullableClient;\nimport com.seed.nullable.resources.nullable.requests.GetUsersRequest;\nimport java.util.Arrays;\n\npublic class Example {\n public static void main(String[] args) {\n SeedNullableClient client = SeedNullableClient\n .builder()\n .build();\n\n client.nullable().getUsers(\n GetUsersRequest\n .builder()\n .usernames(\n Arrays.asList(\"usernames\")\n )\n .activated(\n Arrays.asList(true)\n )\n .tags(\n Arrays.asList(\"tags\")\n )\n .avatar(\"avatar\")\n .extra(true)\n .build()\n );\n }\n}\n", + "async_client": "package com.example.usage;\n\nimport com.seed.nullable.SeedNullableClient;\nimport com.seed.nullable.resources.nullable.requests.GetUsersRequest;\nimport java.util.Arrays;\n\npublic class Example {\n public static void main(String[] args) {\n SeedNullableClient client = SeedNullableClient\n .builder()\n .build();\n\n client.nullable().getUsers(\n GetUsersRequest\n .builder()\n .usernames(\n Arrays.asList(\"usernames\")\n )\n .activated(\n Arrays.asList(true)\n )\n .tags(\n Arrays.asList(\"tags\")\n )\n .avatar(\"avatar\")\n .extra(true)\n .build()\n );\n }\n}\n" } }, { diff --git a/seed/java-sdk/nullable/wrapped-aliases/src/main/java/com/snippets/Example0.java b/seed/java-sdk/nullable/wrapped-aliases/src/main/java/com/snippets/Example0.java index 7ab5c0ea790b..c7bd7e02be17 100644 --- a/seed/java-sdk/nullable/wrapped-aliases/src/main/java/com/snippets/Example0.java +++ b/seed/java-sdk/nullable/wrapped-aliases/src/main/java/com/snippets/Example0.java @@ -3,7 +3,6 @@ import com.seed.nullable.SeedNullableClient; import com.seed.nullable.resources.nullable.requests.GetUsersRequest; import java.util.Arrays; -import java.util.Optional; public class Example0 { public static void main(String[] args) { @@ -14,7 +13,7 @@ public static void main(String[] args) { .getUsers(GetUsersRequest.builder() .usernames(Arrays.asList("usernames")) .activated(Arrays.asList(true)) - .tags(Arrays.asList(Optional.of("tags"))) + .tags(Arrays.asList("tags")) .avatar("avatar") .extra(true) .build()); From 09372f0c466b6c00c9636bc97887d73086fd9626 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 13:16:45 -0400 Subject: [PATCH 31/43] chore(typescript): update ts-sdk seed (#15581) Co-authored-by: dsinghvi <10870189+dsinghvi@users.noreply.github.com> From 73460d27e32b02f46ba1104df3c093410d64c255 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 13:17:07 -0400 Subject: [PATCH 32/43] chore(php): update php-sdk seed (#15582) Co-authored-by: dsinghvi <10870189+dsinghvi@users.noreply.github.com> --- seed/php-sdk/accept-header/README.md | 7 ++++++- seed/php-sdk/alias-extends/README.md | 7 ++++++- seed/php-sdk/alias/composer-json/README.md | 7 ++++++- seed/php-sdk/alias/no-custom-config/README.md | 7 ++++++- seed/php-sdk/allof-inline/README.md | 7 ++++++- seed/php-sdk/allof/README.md | 7 ++++++- seed/php-sdk/any-auth/README.md | 7 ++++++- seed/php-sdk/api-wide-base-path/README.md | 7 ++++++- seed/php-sdk/audiences/README.md | 7 ++++++- seed/php-sdk/basic-auth-environment-variables/README.md | 7 ++++++- seed/php-sdk/basic-auth-pw-omitted/wire-tests/README.md | 7 ++++++- seed/php-sdk/basic-auth/wire-tests/README.md | 7 ++++++- seed/php-sdk/bearer-token-environment-variable/README.md | 7 ++++++- seed/php-sdk/bytes-download/README.md | 7 ++++++- seed/php-sdk/bytes-upload/README.md | 7 ++++++- seed/php-sdk/client-side-params/README.md | 7 ++++++- seed/php-sdk/content-type/README.md | 7 ++++++- seed/php-sdk/cross-package-type-names/README.md | 7 ++++++- seed/php-sdk/endpoint-security-auth/README.md | 7 ++++++- seed/php-sdk/enum/README.md | 7 ++++++- seed/php-sdk/error-property/README.md | 7 ++++++- seed/php-sdk/errors/README.md | 7 ++++++- seed/php-sdk/examples/no-custom-config/README.md | 7 ++++++- seed/php-sdk/examples/readme-config/README.md | 7 ++++++- seed/php-sdk/exhaustive/no-custom-config/README.md | 7 ++++++- seed/php-sdk/exhaustive/wire-tests/README.md | 7 ++++++- seed/php-sdk/extends/no-custom-config/README.md | 7 ++++++- seed/php-sdk/extends/private/README.md | 7 ++++++- seed/php-sdk/extra-properties/README.md | 7 ++++++- seed/php-sdk/file-download/README.md | 7 ++++++- seed/php-sdk/file-upload-openapi/README.md | 7 ++++++- seed/php-sdk/file-upload/README.md | 7 ++++++- seed/php-sdk/folders/no-custom-config/README.md | 7 ++++++- seed/php-sdk/folders/with-interfaces/README.md | 7 ++++++- seed/php-sdk/header-auth-environment-variable/README.md | 7 ++++++- seed/php-sdk/header-auth/README.md | 7 ++++++- seed/php-sdk/http-head/README.md | 7 ++++++- seed/php-sdk/idempotency-headers/README.md | 7 ++++++- seed/php-sdk/imdb/clientName/README.md | 7 ++++++- seed/php-sdk/imdb/namespace/README.md | 7 ++++++- seed/php-sdk/imdb/no-custom-config/README.md | 7 ++++++- seed/php-sdk/imdb/omit-fern-headers/README.md | 7 ++++++- seed/php-sdk/imdb/package-path/README.md | 7 ++++++- seed/php-sdk/imdb/packageName/README.md | 7 ++++++- seed/php-sdk/imdb/private/README.md | 7 ++++++- seed/php-sdk/inferred-auth-explicit/README.md | 7 ++++++- seed/php-sdk/inferred-auth-implicit-api-key/README.md | 7 ++++++- seed/php-sdk/inferred-auth-implicit-no-expiry/README.md | 7 ++++++- seed/php-sdk/inferred-auth-implicit-reference/README.md | 7 ++++++- seed/php-sdk/inferred-auth-implicit/README.md | 7 ++++++- seed/php-sdk/license/README.md | 7 ++++++- seed/php-sdk/literal/README.md | 7 ++++++- seed/php-sdk/mixed-case/README.md | 7 ++++++- seed/php-sdk/mixed-file-directory/README.md | 7 ++++++- seed/php-sdk/multi-line-docs/README.md | 7 ++++++- seed/php-sdk/multi-url-environment-no-default/README.md | 7 ++++++- seed/php-sdk/multi-url-environment-reference/README.md | 7 ++++++- seed/php-sdk/multi-url-environment/README.md | 7 ++++++- seed/php-sdk/multiple-request-bodies/README.md | 7 ++++++- seed/php-sdk/no-content-response/README.md | 7 ++++++- seed/php-sdk/no-environment/README.md | 7 ++++++- seed/php-sdk/no-retries/README.md | 7 ++++++- seed/php-sdk/null-type/README.md | 7 ++++++- seed/php-sdk/nullable-allof-extends/README.md | 7 ++++++- seed/php-sdk/nullable-optional/README.md | 7 ++++++- seed/php-sdk/nullable-request-body/README.md | 7 ++++++- seed/php-sdk/nullable/README.md | 7 ++++++- seed/php-sdk/oauth-client-credentials-custom/README.md | 7 ++++++- seed/php-sdk/oauth-client-credentials-default/README.md | 7 ++++++- .../README.md | 7 ++++++- .../oauth-client-credentials-mandatory-auth/README.md | 7 ++++++- .../php-sdk/oauth-client-credentials-nested-root/README.md | 7 ++++++- seed/php-sdk/oauth-client-credentials-openapi/README.md | 7 ++++++- seed/php-sdk/oauth-client-credentials-reference/README.md | 7 ++++++- .../oauth-client-credentials-with-variables/README.md | 7 ++++++- seed/php-sdk/oauth-client-credentials/README.md | 7 ++++++- seed/php-sdk/openapi-request-body-ref/README.md | 7 ++++++- seed/php-sdk/optional/README.md | 7 ++++++- seed/php-sdk/package-yml/no-custom-config/README.md | 7 ++++++- seed/php-sdk/package-yml/private/README.md | 7 ++++++- seed/php-sdk/pagination-custom/README.md | 7 ++++++- seed/php-sdk/pagination-uri-path/README.md | 7 ++++++- seed/php-sdk/pagination/no-custom-config/README.md | 7 ++++++- seed/php-sdk/pagination/page-index-semantics/README.md | 7 ++++++- seed/php-sdk/pagination/property-accessors/README.md | 7 ++++++- .../inline-path-parameters-private/README.md | 7 ++++++- .../path-parameters/inline-path-parameters/README.md | 7 ++++++- seed/php-sdk/path-parameters/no-custom-config/README.md | 7 ++++++- seed/php-sdk/plain-text/README.md | 7 ++++++- seed/php-sdk/property-access/README.md | 7 ++++++- seed/php-sdk/query-param-name-conflict/README.md | 7 ++++++- seed/php-sdk/query-parameters-openapi-as-objects/README.md | 7 ++++++- seed/php-sdk/query-parameters-openapi/README.md | 7 ++++++- seed/php-sdk/query-parameters/no-custom-config/README.md | 7 ++++++- seed/php-sdk/query-parameters/private/README.md | 7 ++++++- seed/php-sdk/request-parameters/no-custom-config/README.md | 7 ++++++- seed/php-sdk/request-parameters/with-defaults/README.md | 7 ++++++- seed/php-sdk/required-nullable/README.md | 7 ++++++- seed/php-sdk/reserved-keywords/README.md | 7 ++++++- seed/php-sdk/response-property/README.md | 7 ++++++- seed/php-sdk/schemaless-request-body-examples/README.md | 7 ++++++- seed/php-sdk/server-sent-event-examples/README.md | 7 ++++++- seed/php-sdk/server-sent-events-openapi/README.md | 7 ++++++- seed/php-sdk/server-sent-events/README.md | 7 ++++++- seed/php-sdk/server-url-templating/README.md | 7 ++++++- seed/php-sdk/simple-api/README.md | 7 ++++++- seed/php-sdk/simple-fhir/README.md | 7 ++++++- seed/php-sdk/single-url-environment-default/README.md | 7 ++++++- seed/php-sdk/single-url-environment-no-default/README.md | 7 ++++++- seed/php-sdk/streaming-parameter/README.md | 7 ++++++- seed/php-sdk/streaming/README.md | 7 ++++++- seed/php-sdk/trace/README.md | 7 ++++++- .../undiscriminated-union-with-response-property/README.md | 7 ++++++- seed/php-sdk/undiscriminated-unions/README.md | 7 ++++++- seed/php-sdk/union-query-parameters/README.md | 7 ++++++- seed/php-sdk/unions-with-local-date/README.md | 7 ++++++- seed/php-sdk/unions/no-custom-config/README.md | 7 ++++++- seed/php-sdk/unions/property-accessors/README.md | 7 ++++++- seed/php-sdk/unknown/README.md | 7 ++++++- seed/php-sdk/url-form-encoded/README.md | 7 ++++++- seed/php-sdk/validation/README.md | 7 ++++++- seed/php-sdk/variables/README.md | 7 ++++++- seed/php-sdk/version-no-default/README.md | 7 ++++++- seed/php-sdk/version/README.md | 7 ++++++- seed/php-sdk/websocket-inferred-auth/README.md | 7 ++++++- seed/php-sdk/x-fern-default/README.md | 7 ++++++- 126 files changed, 756 insertions(+), 126 deletions(-) diff --git a/seed/php-sdk/accept-header/README.md b/seed/php-sdk/accept-header/README.md index 9ec6b8ba84bb..254dfb0f1320 100644 --- a/seed/php-sdk/accept-header/README.md +++ b/seed/php-sdk/accept-header/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/alias-extends/README.md b/seed/php-sdk/alias-extends/README.md index 41e9071f6602..57d284c9a80a 100644 --- a/seed/php-sdk/alias-extends/README.md +++ b/seed/php-sdk/alias-extends/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/alias/composer-json/README.md b/seed/php-sdk/alias/composer-json/README.md index 9402a45554d1..ba71fdb73318 100644 --- a/seed/php-sdk/alias/composer-json/README.md +++ b/seed/php-sdk/alias/composer-json/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/alias/no-custom-config/README.md b/seed/php-sdk/alias/no-custom-config/README.md index 9402a45554d1..ba71fdb73318 100644 --- a/seed/php-sdk/alias/no-custom-config/README.md +++ b/seed/php-sdk/alias/no-custom-config/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/allof-inline/README.md b/seed/php-sdk/allof-inline/README.md index 0b89aa3897c7..af10d1ebae9f 100644 --- a/seed/php-sdk/allof-inline/README.md +++ b/seed/php-sdk/allof-inline/README.md @@ -132,7 +132,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/allof/README.md b/seed/php-sdk/allof/README.md index 0b89aa3897c7..af10d1ebae9f 100644 --- a/seed/php-sdk/allof/README.md +++ b/seed/php-sdk/allof/README.md @@ -132,7 +132,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/any-auth/README.md b/seed/php-sdk/any-auth/README.md index 40d744a86c09..47ef2a14a5b4 100644 --- a/seed/php-sdk/any-auth/README.md +++ b/seed/php-sdk/any-auth/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/api-wide-base-path/README.md b/seed/php-sdk/api-wide-base-path/README.md index 341349b4c519..26a12c5d1429 100644 --- a/seed/php-sdk/api-wide-base-path/README.md +++ b/seed/php-sdk/api-wide-base-path/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/audiences/README.md b/seed/php-sdk/audiences/README.md index e471364e9947..1e85101dd5d6 100644 --- a/seed/php-sdk/audiences/README.md +++ b/seed/php-sdk/audiences/README.md @@ -133,7 +133,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/basic-auth-environment-variables/README.md b/seed/php-sdk/basic-auth-environment-variables/README.md index 661eab1053b5..8e7519bbc574 100644 --- a/seed/php-sdk/basic-auth-environment-variables/README.md +++ b/seed/php-sdk/basic-auth-environment-variables/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/basic-auth-pw-omitted/wire-tests/README.md b/seed/php-sdk/basic-auth-pw-omitted/wire-tests/README.md index 6bee0080f4ff..90df14006329 100644 --- a/seed/php-sdk/basic-auth-pw-omitted/wire-tests/README.md +++ b/seed/php-sdk/basic-auth-pw-omitted/wire-tests/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/basic-auth/wire-tests/README.md b/seed/php-sdk/basic-auth/wire-tests/README.md index 269cd0bb42b1..ee15c97eba5d 100644 --- a/seed/php-sdk/basic-auth/wire-tests/README.md +++ b/seed/php-sdk/basic-auth/wire-tests/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/bearer-token-environment-variable/README.md b/seed/php-sdk/bearer-token-environment-variable/README.md index 9e3becb06b72..5f595e58902b 100644 --- a/seed/php-sdk/bearer-token-environment-variable/README.md +++ b/seed/php-sdk/bearer-token-environment-variable/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/bytes-download/README.md b/seed/php-sdk/bytes-download/README.md index 97a7b94697b4..fa5e495d5cae 100644 --- a/seed/php-sdk/bytes-download/README.md +++ b/seed/php-sdk/bytes-download/README.md @@ -101,7 +101,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/bytes-upload/README.md b/seed/php-sdk/bytes-upload/README.md index d4a5ef29441a..ec94aa6adda7 100644 --- a/seed/php-sdk/bytes-upload/README.md +++ b/seed/php-sdk/bytes-upload/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/client-side-params/README.md b/seed/php-sdk/client-side-params/README.md index 72be5b3b17ed..36e50bc9a795 100644 --- a/seed/php-sdk/client-side-params/README.md +++ b/seed/php-sdk/client-side-params/README.md @@ -115,7 +115,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/content-type/README.md b/seed/php-sdk/content-type/README.md index f662120c94c8..7b98c64d6cc9 100644 --- a/seed/php-sdk/content-type/README.md +++ b/seed/php-sdk/content-type/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/cross-package-type-names/README.md b/seed/php-sdk/cross-package-type-names/README.md index ecf788519a3b..9a2991bab643 100644 --- a/seed/php-sdk/cross-package-type-names/README.md +++ b/seed/php-sdk/cross-package-type-names/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/endpoint-security-auth/README.md b/seed/php-sdk/endpoint-security-auth/README.md index 40d744a86c09..47ef2a14a5b4 100644 --- a/seed/php-sdk/endpoint-security-auth/README.md +++ b/seed/php-sdk/endpoint-security-auth/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/enum/README.md b/seed/php-sdk/enum/README.md index c2b3bff18013..86b3ac53e6a0 100644 --- a/seed/php-sdk/enum/README.md +++ b/seed/php-sdk/enum/README.md @@ -110,7 +110,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/error-property/README.md b/seed/php-sdk/error-property/README.md index bd91e3983bed..4d946717de5b 100644 --- a/seed/php-sdk/error-property/README.md +++ b/seed/php-sdk/error-property/README.md @@ -101,7 +101,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/errors/README.md b/seed/php-sdk/errors/README.md index e0e193ae57c8..f647b0e0bd2e 100644 --- a/seed/php-sdk/errors/README.md +++ b/seed/php-sdk/errors/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/examples/no-custom-config/README.md b/seed/php-sdk/examples/no-custom-config/README.md index 5fc59efcf5cf..7591e794d8c6 100644 --- a/seed/php-sdk/examples/no-custom-config/README.md +++ b/seed/php-sdk/examples/no-custom-config/README.md @@ -130,7 +130,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/examples/readme-config/README.md b/seed/php-sdk/examples/readme-config/README.md index 7afa55317834..8b441d414899 100644 --- a/seed/php-sdk/examples/readme-config/README.md +++ b/seed/php-sdk/examples/readme-config/README.md @@ -174,7 +174,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/exhaustive/no-custom-config/README.md b/seed/php-sdk/exhaustive/no-custom-config/README.md index 7f43361f26aa..2a7613bc5095 100644 --- a/seed/php-sdk/exhaustive/no-custom-config/README.md +++ b/seed/php-sdk/exhaustive/no-custom-config/README.md @@ -138,7 +138,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/exhaustive/wire-tests/README.md b/seed/php-sdk/exhaustive/wire-tests/README.md index 7f43361f26aa..2a7613bc5095 100644 --- a/seed/php-sdk/exhaustive/wire-tests/README.md +++ b/seed/php-sdk/exhaustive/wire-tests/README.md @@ -138,7 +138,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/extends/no-custom-config/README.md b/seed/php-sdk/extends/no-custom-config/README.md index 2cb4b4bac6eb..0882a7fa351b 100644 --- a/seed/php-sdk/extends/no-custom-config/README.md +++ b/seed/php-sdk/extends/no-custom-config/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/extends/private/README.md b/seed/php-sdk/extends/private/README.md index 2cb4b4bac6eb..0882a7fa351b 100644 --- a/seed/php-sdk/extends/private/README.md +++ b/seed/php-sdk/extends/private/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/extra-properties/README.md b/seed/php-sdk/extra-properties/README.md index 425ab9c47b89..a34118c84c6a 100644 --- a/seed/php-sdk/extra-properties/README.md +++ b/seed/php-sdk/extra-properties/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/file-download/README.md b/seed/php-sdk/file-download/README.md index 97a7b94697b4..fa5e495d5cae 100644 --- a/seed/php-sdk/file-download/README.md +++ b/seed/php-sdk/file-download/README.md @@ -101,7 +101,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/file-upload-openapi/README.md b/seed/php-sdk/file-upload-openapi/README.md index eb29bd796230..580c63ec0986 100644 --- a/seed/php-sdk/file-upload-openapi/README.md +++ b/seed/php-sdk/file-upload-openapi/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/file-upload/README.md b/seed/php-sdk/file-upload/README.md index d969ff87cc14..6df304e902b3 100644 --- a/seed/php-sdk/file-upload/README.md +++ b/seed/php-sdk/file-upload/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/folders/no-custom-config/README.md b/seed/php-sdk/folders/no-custom-config/README.md index 0948f0e0819d..01a7edf50746 100644 --- a/seed/php-sdk/folders/no-custom-config/README.md +++ b/seed/php-sdk/folders/no-custom-config/README.md @@ -101,7 +101,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/folders/with-interfaces/README.md b/seed/php-sdk/folders/with-interfaces/README.md index 0948f0e0819d..01a7edf50746 100644 --- a/seed/php-sdk/folders/with-interfaces/README.md +++ b/seed/php-sdk/folders/with-interfaces/README.md @@ -101,7 +101,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/header-auth-environment-variable/README.md b/seed/php-sdk/header-auth-environment-variable/README.md index 2b4d49f35632..9c6668b705d4 100644 --- a/seed/php-sdk/header-auth-environment-variable/README.md +++ b/seed/php-sdk/header-auth-environment-variable/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/header-auth/README.md b/seed/php-sdk/header-auth/README.md index 27d41bf70cd9..4a245a65cc33 100644 --- a/seed/php-sdk/header-auth/README.md +++ b/seed/php-sdk/header-auth/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/http-head/README.md b/seed/php-sdk/http-head/README.md index 5492ddbbd12a..ac55ed1672bc 100644 --- a/seed/php-sdk/http-head/README.md +++ b/seed/php-sdk/http-head/README.md @@ -101,7 +101,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/idempotency-headers/README.md b/seed/php-sdk/idempotency-headers/README.md index 1578a6789f93..b7355c02217b 100644 --- a/seed/php-sdk/idempotency-headers/README.md +++ b/seed/php-sdk/idempotency-headers/README.md @@ -110,7 +110,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/imdb/clientName/README.md b/seed/php-sdk/imdb/clientName/README.md index 1dcae3b2cb71..cf597cf4e10d 100644 --- a/seed/php-sdk/imdb/clientName/README.md +++ b/seed/php-sdk/imdb/clientName/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/imdb/namespace/README.md b/seed/php-sdk/imdb/namespace/README.md index 1a95e98b5809..2b8fde51442a 100644 --- a/seed/php-sdk/imdb/namespace/README.md +++ b/seed/php-sdk/imdb/namespace/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/imdb/no-custom-config/README.md b/seed/php-sdk/imdb/no-custom-config/README.md index f57c693ef3f1..25020eb6fc61 100644 --- a/seed/php-sdk/imdb/no-custom-config/README.md +++ b/seed/php-sdk/imdb/no-custom-config/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/imdb/omit-fern-headers/README.md b/seed/php-sdk/imdb/omit-fern-headers/README.md index f57c693ef3f1..25020eb6fc61 100644 --- a/seed/php-sdk/imdb/omit-fern-headers/README.md +++ b/seed/php-sdk/imdb/omit-fern-headers/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/imdb/package-path/README.md b/seed/php-sdk/imdb/package-path/README.md index ffa33a7180dc..d649c2109086 100644 --- a/seed/php-sdk/imdb/package-path/README.md +++ b/seed/php-sdk/imdb/package-path/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/imdb/packageName/README.md b/seed/php-sdk/imdb/packageName/README.md index 66bdabba35af..21839d8c6d88 100644 --- a/seed/php-sdk/imdb/packageName/README.md +++ b/seed/php-sdk/imdb/packageName/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/imdb/private/README.md b/seed/php-sdk/imdb/private/README.md index f57c693ef3f1..25020eb6fc61 100644 --- a/seed/php-sdk/imdb/private/README.md +++ b/seed/php-sdk/imdb/private/README.md @@ -109,7 +109,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/inferred-auth-explicit/README.md b/seed/php-sdk/inferred-auth-explicit/README.md index f3f89a7deebc..3a275f7850f3 100644 --- a/seed/php-sdk/inferred-auth-explicit/README.md +++ b/seed/php-sdk/inferred-auth-explicit/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/inferred-auth-implicit-api-key/README.md b/seed/php-sdk/inferred-auth-implicit-api-key/README.md index e3b6d90de17b..5ee96b4b558d 100644 --- a/seed/php-sdk/inferred-auth-implicit-api-key/README.md +++ b/seed/php-sdk/inferred-auth-implicit-api-key/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/inferred-auth-implicit-no-expiry/README.md b/seed/php-sdk/inferred-auth-implicit-no-expiry/README.md index f3f89a7deebc..3a275f7850f3 100644 --- a/seed/php-sdk/inferred-auth-implicit-no-expiry/README.md +++ b/seed/php-sdk/inferred-auth-implicit-no-expiry/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/inferred-auth-implicit-reference/README.md b/seed/php-sdk/inferred-auth-implicit-reference/README.md index 503f9a2e0634..cd58454e494c 100644 --- a/seed/php-sdk/inferred-auth-implicit-reference/README.md +++ b/seed/php-sdk/inferred-auth-implicit-reference/README.md @@ -110,7 +110,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/inferred-auth-implicit/README.md b/seed/php-sdk/inferred-auth-implicit/README.md index f3f89a7deebc..3a275f7850f3 100644 --- a/seed/php-sdk/inferred-auth-implicit/README.md +++ b/seed/php-sdk/inferred-auth-implicit/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/license/README.md b/seed/php-sdk/license/README.md index 85f46e07b7bc..a797fe40426c 100644 --- a/seed/php-sdk/license/README.md +++ b/seed/php-sdk/license/README.md @@ -101,7 +101,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/literal/README.md b/seed/php-sdk/literal/README.md index 9954e62fa448..73e004d6d1fd 100644 --- a/seed/php-sdk/literal/README.md +++ b/seed/php-sdk/literal/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/mixed-case/README.md b/seed/php-sdk/mixed-case/README.md index 5da6f8f30999..6b5ce11c1f6b 100644 --- a/seed/php-sdk/mixed-case/README.md +++ b/seed/php-sdk/mixed-case/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/mixed-file-directory/README.md b/seed/php-sdk/mixed-file-directory/README.md index 0d6e2c52c448..5aecf26a2c56 100644 --- a/seed/php-sdk/mixed-file-directory/README.md +++ b/seed/php-sdk/mixed-file-directory/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/multi-line-docs/README.md b/seed/php-sdk/multi-line-docs/README.md index 3dfa231c79e0..b1ca918096a5 100644 --- a/seed/php-sdk/multi-line-docs/README.md +++ b/seed/php-sdk/multi-line-docs/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/multi-url-environment-no-default/README.md b/seed/php-sdk/multi-url-environment-no-default/README.md index 6da487c55441..f9acd7495c92 100644 --- a/seed/php-sdk/multi-url-environment-no-default/README.md +++ b/seed/php-sdk/multi-url-environment-no-default/README.md @@ -151,7 +151,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/multi-url-environment-reference/README.md b/seed/php-sdk/multi-url-environment-reference/README.md index b8c01ae40c95..ac86b2b25c56 100644 --- a/seed/php-sdk/multi-url-environment-reference/README.md +++ b/seed/php-sdk/multi-url-environment-reference/README.md @@ -153,7 +153,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/multi-url-environment/README.md b/seed/php-sdk/multi-url-environment/README.md index 6da487c55441..f9acd7495c92 100644 --- a/seed/php-sdk/multi-url-environment/README.md +++ b/seed/php-sdk/multi-url-environment/README.md @@ -151,7 +151,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/multiple-request-bodies/README.md b/seed/php-sdk/multiple-request-bodies/README.md index c7f2efd95708..cf57f4aaf354 100644 --- a/seed/php-sdk/multiple-request-bodies/README.md +++ b/seed/php-sdk/multiple-request-bodies/README.md @@ -130,7 +130,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/no-content-response/README.md b/seed/php-sdk/no-content-response/README.md index ad4ba85c0502..3e10e964b754 100644 --- a/seed/php-sdk/no-content-response/README.md +++ b/seed/php-sdk/no-content-response/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/no-environment/README.md b/seed/php-sdk/no-environment/README.md index 1b1f2efc2762..5ae2375d1e16 100644 --- a/seed/php-sdk/no-environment/README.md +++ b/seed/php-sdk/no-environment/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/no-retries/README.md b/seed/php-sdk/no-retries/README.md index f64672c1a757..f6b8305b2dd0 100644 --- a/seed/php-sdk/no-retries/README.md +++ b/seed/php-sdk/no-retries/README.md @@ -101,7 +101,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/null-type/README.md b/seed/php-sdk/null-type/README.md index f8fff9b0dd88..748c9a184ef5 100644 --- a/seed/php-sdk/null-type/README.md +++ b/seed/php-sdk/null-type/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/nullable-allof-extends/README.md b/seed/php-sdk/nullable-allof-extends/README.md index 9baeb7ca8d4f..225023ce0694 100644 --- a/seed/php-sdk/nullable-allof-extends/README.md +++ b/seed/php-sdk/nullable-allof-extends/README.md @@ -128,7 +128,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/nullable-optional/README.md b/seed/php-sdk/nullable-optional/README.md index 9810a7fcb1c0..a7634493a3b9 100644 --- a/seed/php-sdk/nullable-optional/README.md +++ b/seed/php-sdk/nullable-optional/README.md @@ -118,7 +118,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/nullable-request-body/README.md b/seed/php-sdk/nullable-request-body/README.md index 03e0b94b0a3b..7718d3382959 100644 --- a/seed/php-sdk/nullable-request-body/README.md +++ b/seed/php-sdk/nullable-request-body/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/nullable/README.md b/seed/php-sdk/nullable/README.md index a976d7b24be6..3e9002b0bd9d 100644 --- a/seed/php-sdk/nullable/README.md +++ b/seed/php-sdk/nullable/README.md @@ -124,7 +124,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/oauth-client-credentials-custom/README.md b/seed/php-sdk/oauth-client-credentials-custom/README.md index 68b12c20b826..eee4d668c703 100644 --- a/seed/php-sdk/oauth-client-credentials-custom/README.md +++ b/seed/php-sdk/oauth-client-credentials-custom/README.md @@ -115,7 +115,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/oauth-client-credentials-default/README.md b/seed/php-sdk/oauth-client-credentials-default/README.md index 7c7bcb16204a..4ea8e6b6491d 100644 --- a/seed/php-sdk/oauth-client-credentials-default/README.md +++ b/seed/php-sdk/oauth-client-credentials-default/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/oauth-client-credentials-environment-variables/README.md b/seed/php-sdk/oauth-client-credentials-environment-variables/README.md index 20fafb8f5b5e..aec8871bf774 100644 --- a/seed/php-sdk/oauth-client-credentials-environment-variables/README.md +++ b/seed/php-sdk/oauth-client-credentials-environment-variables/README.md @@ -113,7 +113,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/oauth-client-credentials-mandatory-auth/README.md b/seed/php-sdk/oauth-client-credentials-mandatory-auth/README.md index f9640e122c8f..9c454edbc066 100644 --- a/seed/php-sdk/oauth-client-credentials-mandatory-auth/README.md +++ b/seed/php-sdk/oauth-client-credentials-mandatory-auth/README.md @@ -113,7 +113,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/oauth-client-credentials-nested-root/README.md b/seed/php-sdk/oauth-client-credentials-nested-root/README.md index 46832215da88..a2667ae5d07b 100644 --- a/seed/php-sdk/oauth-client-credentials-nested-root/README.md +++ b/seed/php-sdk/oauth-client-credentials-nested-root/README.md @@ -113,7 +113,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/oauth-client-credentials-openapi/README.md b/seed/php-sdk/oauth-client-credentials-openapi/README.md index d5128699fa51..cfcc1eeb154e 100644 --- a/seed/php-sdk/oauth-client-credentials-openapi/README.md +++ b/seed/php-sdk/oauth-client-credentials-openapi/README.md @@ -110,7 +110,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/oauth-client-credentials-reference/README.md b/seed/php-sdk/oauth-client-credentials-reference/README.md index b4f4aec4592e..8b6c65e7ca78 100644 --- a/seed/php-sdk/oauth-client-credentials-reference/README.md +++ b/seed/php-sdk/oauth-client-credentials-reference/README.md @@ -110,7 +110,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/oauth-client-credentials-with-variables/README.md b/seed/php-sdk/oauth-client-credentials-with-variables/README.md index 20fafb8f5b5e..aec8871bf774 100644 --- a/seed/php-sdk/oauth-client-credentials-with-variables/README.md +++ b/seed/php-sdk/oauth-client-credentials-with-variables/README.md @@ -113,7 +113,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/oauth-client-credentials/README.md b/seed/php-sdk/oauth-client-credentials/README.md index f9640e122c8f..9c454edbc066 100644 --- a/seed/php-sdk/oauth-client-credentials/README.md +++ b/seed/php-sdk/oauth-client-credentials/README.md @@ -113,7 +113,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/openapi-request-body-ref/README.md b/seed/php-sdk/openapi-request-body-ref/README.md index 1dd3645835a0..76768043f4ad 100644 --- a/seed/php-sdk/openapi-request-body-ref/README.md +++ b/seed/php-sdk/openapi-request-body-ref/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/optional/README.md b/seed/php-sdk/optional/README.md index d4df2bdd908d..27eaa1510350 100644 --- a/seed/php-sdk/optional/README.md +++ b/seed/php-sdk/optional/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/package-yml/no-custom-config/README.md b/seed/php-sdk/package-yml/no-custom-config/README.md index db490b924f0e..94f0efd2d85b 100644 --- a/seed/php-sdk/package-yml/no-custom-config/README.md +++ b/seed/php-sdk/package-yml/no-custom-config/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/package-yml/private/README.md b/seed/php-sdk/package-yml/private/README.md index db490b924f0e..94f0efd2d85b 100644 --- a/seed/php-sdk/package-yml/private/README.md +++ b/seed/php-sdk/package-yml/private/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/pagination-custom/README.md b/seed/php-sdk/pagination-custom/README.md index 21021ba2405e..bdd5eabe1884 100644 --- a/seed/php-sdk/pagination-custom/README.md +++ b/seed/php-sdk/pagination-custom/README.md @@ -139,7 +139,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/pagination-uri-path/README.md b/seed/php-sdk/pagination-uri-path/README.md index f5b3cc29fa75..4db795436d3c 100644 --- a/seed/php-sdk/pagination-uri-path/README.md +++ b/seed/php-sdk/pagination-uri-path/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/pagination/no-custom-config/README.md b/seed/php-sdk/pagination/no-custom-config/README.md index fb7c8d124a88..85c903139879 100644 --- a/seed/php-sdk/pagination/no-custom-config/README.md +++ b/seed/php-sdk/pagination/no-custom-config/README.md @@ -150,7 +150,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/pagination/page-index-semantics/README.md b/seed/php-sdk/pagination/page-index-semantics/README.md index fb7c8d124a88..85c903139879 100644 --- a/seed/php-sdk/pagination/page-index-semantics/README.md +++ b/seed/php-sdk/pagination/page-index-semantics/README.md @@ -150,7 +150,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/pagination/property-accessors/README.md b/seed/php-sdk/pagination/property-accessors/README.md index fb7c8d124a88..85c903139879 100644 --- a/seed/php-sdk/pagination/property-accessors/README.md +++ b/seed/php-sdk/pagination/property-accessors/README.md @@ -150,7 +150,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/path-parameters/inline-path-parameters-private/README.md b/seed/php-sdk/path-parameters/inline-path-parameters-private/README.md index 7587d4b39635..018d2ec82720 100644 --- a/seed/php-sdk/path-parameters/inline-path-parameters-private/README.md +++ b/seed/php-sdk/path-parameters/inline-path-parameters-private/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/path-parameters/inline-path-parameters/README.md b/seed/php-sdk/path-parameters/inline-path-parameters/README.md index 7587d4b39635..018d2ec82720 100644 --- a/seed/php-sdk/path-parameters/inline-path-parameters/README.md +++ b/seed/php-sdk/path-parameters/inline-path-parameters/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/path-parameters/no-custom-config/README.md b/seed/php-sdk/path-parameters/no-custom-config/README.md index 7587d4b39635..018d2ec82720 100644 --- a/seed/php-sdk/path-parameters/no-custom-config/README.md +++ b/seed/php-sdk/path-parameters/no-custom-config/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/plain-text/README.md b/seed/php-sdk/plain-text/README.md index 6872fb744e4e..17f960ee9536 100644 --- a/seed/php-sdk/plain-text/README.md +++ b/seed/php-sdk/plain-text/README.md @@ -101,7 +101,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/property-access/README.md b/seed/php-sdk/property-access/README.md index 2456e6b8db29..14bd707cb780 100644 --- a/seed/php-sdk/property-access/README.md +++ b/seed/php-sdk/property-access/README.md @@ -117,7 +117,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/query-param-name-conflict/README.md b/seed/php-sdk/query-param-name-conflict/README.md index f73475a71d7e..dcdba2dcc52b 100644 --- a/seed/php-sdk/query-param-name-conflict/README.md +++ b/seed/php-sdk/query-param-name-conflict/README.md @@ -104,7 +104,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/query-parameters-openapi-as-objects/README.md b/seed/php-sdk/query-parameters-openapi-as-objects/README.md index a29130bb756c..14c997ea9f7d 100644 --- a/seed/php-sdk/query-parameters-openapi-as-objects/README.md +++ b/seed/php-sdk/query-parameters-openapi-as-objects/README.md @@ -183,7 +183,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/query-parameters-openapi/README.md b/seed/php-sdk/query-parameters-openapi/README.md index a29130bb756c..14c997ea9f7d 100644 --- a/seed/php-sdk/query-parameters-openapi/README.md +++ b/seed/php-sdk/query-parameters-openapi/README.md @@ -183,7 +183,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/query-parameters/no-custom-config/README.md b/seed/php-sdk/query-parameters/no-custom-config/README.md index 35786196f1f1..0b6945aa68ce 100644 --- a/seed/php-sdk/query-parameters/no-custom-config/README.md +++ b/seed/php-sdk/query-parameters/no-custom-config/README.md @@ -170,7 +170,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/query-parameters/private/README.md b/seed/php-sdk/query-parameters/private/README.md index 35786196f1f1..0b6945aa68ce 100644 --- a/seed/php-sdk/query-parameters/private/README.md +++ b/seed/php-sdk/query-parameters/private/README.md @@ -170,7 +170,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/request-parameters/no-custom-config/README.md b/seed/php-sdk/request-parameters/no-custom-config/README.md index a97c4a4ac49e..5a5a97d00fd1 100644 --- a/seed/php-sdk/request-parameters/no-custom-config/README.md +++ b/seed/php-sdk/request-parameters/no-custom-config/README.md @@ -112,7 +112,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/request-parameters/with-defaults/README.md b/seed/php-sdk/request-parameters/with-defaults/README.md index a97c4a4ac49e..5a5a97d00fd1 100644 --- a/seed/php-sdk/request-parameters/with-defaults/README.md +++ b/seed/php-sdk/request-parameters/with-defaults/README.md @@ -112,7 +112,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/required-nullable/README.md b/seed/php-sdk/required-nullable/README.md index e2fe31f8151a..e2dec7b1d84a 100644 --- a/seed/php-sdk/required-nullable/README.md +++ b/seed/php-sdk/required-nullable/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/reserved-keywords/README.md b/seed/php-sdk/reserved-keywords/README.md index fdc32dd50d27..6af09a86ed1b 100644 --- a/seed/php-sdk/reserved-keywords/README.md +++ b/seed/php-sdk/reserved-keywords/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/response-property/README.md b/seed/php-sdk/response-property/README.md index bcdd4bd6a20a..db2caf90978c 100644 --- a/seed/php-sdk/response-property/README.md +++ b/seed/php-sdk/response-property/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/schemaless-request-body-examples/README.md b/seed/php-sdk/schemaless-request-body-examples/README.md index f1774c38e13e..4cd994d64930 100644 --- a/seed/php-sdk/schemaless-request-body-examples/README.md +++ b/seed/php-sdk/schemaless-request-body-examples/README.md @@ -115,7 +115,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/server-sent-event-examples/README.md b/seed/php-sdk/server-sent-event-examples/README.md index acb2c418ccdc..e6db281d0a9a 100644 --- a/seed/php-sdk/server-sent-event-examples/README.md +++ b/seed/php-sdk/server-sent-event-examples/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/server-sent-events-openapi/README.md b/seed/php-sdk/server-sent-events-openapi/README.md index 568cc9647ea7..e56dd690646a 100644 --- a/seed/php-sdk/server-sent-events-openapi/README.md +++ b/seed/php-sdk/server-sent-events-openapi/README.md @@ -104,7 +104,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/server-sent-events/README.md b/seed/php-sdk/server-sent-events/README.md index acb2c418ccdc..e6db281d0a9a 100644 --- a/seed/php-sdk/server-sent-events/README.md +++ b/seed/php-sdk/server-sent-events/README.md @@ -106,7 +106,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/server-url-templating/README.md b/seed/php-sdk/server-url-templating/README.md index dc5fa77d09ac..adff03e6d07b 100644 --- a/seed/php-sdk/server-url-templating/README.md +++ b/seed/php-sdk/server-url-templating/README.md @@ -150,7 +150,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/simple-api/README.md b/seed/php-sdk/simple-api/README.md index ea9333984fee..bba9d4b04bf5 100644 --- a/seed/php-sdk/simple-api/README.md +++ b/seed/php-sdk/simple-api/README.md @@ -130,7 +130,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/simple-fhir/README.md b/seed/php-sdk/simple-fhir/README.md index 6e5548ba0dad..ebe29a485974 100644 --- a/seed/php-sdk/simple-fhir/README.md +++ b/seed/php-sdk/simple-fhir/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/single-url-environment-default/README.md b/seed/php-sdk/single-url-environment-default/README.md index e41f5311ad74..74dda1ab097c 100644 --- a/seed/php-sdk/single-url-environment-default/README.md +++ b/seed/php-sdk/single-url-environment-default/README.md @@ -128,7 +128,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/single-url-environment-no-default/README.md b/seed/php-sdk/single-url-environment-no-default/README.md index e41f5311ad74..74dda1ab097c 100644 --- a/seed/php-sdk/single-url-environment-no-default/README.md +++ b/seed/php-sdk/single-url-environment-no-default/README.md @@ -128,7 +128,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/streaming-parameter/README.md b/seed/php-sdk/streaming-parameter/README.md index b616a9b4b5b6..58af0943c5e2 100644 --- a/seed/php-sdk/streaming-parameter/README.md +++ b/seed/php-sdk/streaming-parameter/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/streaming/README.md b/seed/php-sdk/streaming/README.md index 3de3f7313e46..f10fc46cb463 100644 --- a/seed/php-sdk/streaming/README.md +++ b/seed/php-sdk/streaming/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/trace/README.md b/seed/php-sdk/trace/README.md index 7d89f1e5fef4..67d6152c1034 100644 --- a/seed/php-sdk/trace/README.md +++ b/seed/php-sdk/trace/README.md @@ -131,7 +131,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/undiscriminated-union-with-response-property/README.md b/seed/php-sdk/undiscriminated-union-with-response-property/README.md index 8c1c7258d935..9abdb22bf874 100644 --- a/seed/php-sdk/undiscriminated-union-with-response-property/README.md +++ b/seed/php-sdk/undiscriminated-union-with-response-property/README.md @@ -101,7 +101,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/undiscriminated-unions/README.md b/seed/php-sdk/undiscriminated-unions/README.md index 23f4592fbfcf..4ce0ab6d28f7 100644 --- a/seed/php-sdk/undiscriminated-unions/README.md +++ b/seed/php-sdk/undiscriminated-unions/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/union-query-parameters/README.md b/seed/php-sdk/union-query-parameters/README.md index db213861ffc3..3861305e416d 100644 --- a/seed/php-sdk/union-query-parameters/README.md +++ b/seed/php-sdk/union-query-parameters/README.md @@ -108,7 +108,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/unions-with-local-date/README.md b/seed/php-sdk/unions-with-local-date/README.md index 12aa5211955e..75decd1f6db8 100644 --- a/seed/php-sdk/unions-with-local-date/README.md +++ b/seed/php-sdk/unions-with-local-date/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/unions/no-custom-config/README.md b/seed/php-sdk/unions/no-custom-config/README.md index 12aa5211955e..75decd1f6db8 100644 --- a/seed/php-sdk/unions/no-custom-config/README.md +++ b/seed/php-sdk/unions/no-custom-config/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/unions/property-accessors/README.md b/seed/php-sdk/unions/property-accessors/README.md index 12aa5211955e..75decd1f6db8 100644 --- a/seed/php-sdk/unions/property-accessors/README.md +++ b/seed/php-sdk/unions/property-accessors/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/unknown/README.md b/seed/php-sdk/unknown/README.md index aa98d80e56ef..d8f4f396cd1d 100644 --- a/seed/php-sdk/unknown/README.md +++ b/seed/php-sdk/unknown/README.md @@ -105,7 +105,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/url-form-encoded/README.md b/seed/php-sdk/url-form-encoded/README.md index 39c639a6c83e..8dab4c5849a5 100644 --- a/seed/php-sdk/url-form-encoded/README.md +++ b/seed/php-sdk/url-form-encoded/README.md @@ -107,7 +107,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/validation/README.md b/seed/php-sdk/validation/README.md index c0c1a79c7b6c..fbe0d189f6a4 100644 --- a/seed/php-sdk/validation/README.md +++ b/seed/php-sdk/validation/README.md @@ -110,7 +110,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/variables/README.md b/seed/php-sdk/variables/README.md index 1e4966ab1004..7e597b3e393d 100644 --- a/seed/php-sdk/variables/README.md +++ b/seed/php-sdk/variables/README.md @@ -101,7 +101,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/version-no-default/README.md b/seed/php-sdk/version-no-default/README.md index 7959618ce34d..b813f49f7ffb 100644 --- a/seed/php-sdk/version-no-default/README.md +++ b/seed/php-sdk/version-no-default/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/version/README.md b/seed/php-sdk/version/README.md index 7959618ce34d..b813f49f7ffb 100644 --- a/seed/php-sdk/version/README.md +++ b/seed/php-sdk/version/README.md @@ -103,7 +103,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/websocket-inferred-auth/README.md b/seed/php-sdk/websocket-inferred-auth/README.md index f3f89a7deebc..3a275f7850f3 100644 --- a/seed/php-sdk/websocket-inferred-auth/README.md +++ b/seed/php-sdk/websocket-inferred-auth/README.md @@ -111,7 +111,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. diff --git a/seed/php-sdk/x-fern-default/README.md b/seed/php-sdk/x-fern-default/README.md index 347a21e342e0..28af19c89036 100644 --- a/seed/php-sdk/x-fern-default/README.md +++ b/seed/php-sdk/x-fern-default/README.md @@ -105,7 +105,12 @@ A request is deemed retryable when any of the following HTTP status codes is ret - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error) + +The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried: + +- `legacy` (default): Retries `408`, `429`, and all `>= 500` +- `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures) Use the `maxRetries` request option to configure this behavior. From 6f272d05f65b2335de86ae26d1388b9f56480bdd Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Apr 2026 10:18:43 -0700 Subject: [PATCH 33/43] fix(ruby): strip trailing whitespace from generated comments (#15538) * fix(ruby-v2): strip trailing whitespace from comment lines Layout/TrailingWhitespace was previously autocorrected by 'rubocop -A' at generation time. Now that the autocorrect pass is removed, spec-controlled docstrings with trailing whitespace surface as offenses (caught on the Square nightly baseline benchmark). Co-Authored-By: barry.zou * chore(ruby-v2): add changelog for trailing-whitespace fix Co-Authored-By: barry.zou --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: barry.zou --- generators/ruby-v2/ast/src/ast/Comment.ts | 3 ++- .../ruby-v2/ast/src/ast/__test__/Comment.test.ts | 16 ++++++++++++++++ .../__test__/__snapshots__/Comment.test.ts.snap | 13 +++++++++++++ .../unreleased/strip-comment-trailing-ws.yml | 5 +++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 generators/ruby-v2/sdk/changes/unreleased/strip-comment-trailing-ws.yml diff --git a/generators/ruby-v2/ast/src/ast/Comment.ts b/generators/ruby-v2/ast/src/ast/Comment.ts index 4ae01239ec93..eecac0548695 100644 --- a/generators/ruby-v2/ast/src/ast/Comment.ts +++ b/generators/ruby-v2/ast/src/ast/Comment.ts @@ -25,7 +25,8 @@ export class Comment extends AstNode { this.docs.split("\n").forEach((line) => { const wrappedLines = this.wrapLine(line, writer); wrappedLines.forEach((wrappedLine) => { - writer.writeLine(`# ${wrappedLine}`); + const trimmed = wrappedLine.trimEnd(); + writer.writeLine(trimmed === "" ? "#" : `# ${trimmed}`); }); }); } diff --git a/generators/ruby-v2/ast/src/ast/__test__/Comment.test.ts b/generators/ruby-v2/ast/src/ast/__test__/Comment.test.ts index bf5616a6a797..769643418507 100644 --- a/generators/ruby-v2/ast/src/ast/__test__/Comment.test.ts +++ b/generators/ruby-v2/ast/src/ast/__test__/Comment.test.ts @@ -58,6 +58,22 @@ describe("Comment", () => { expect(comment.toString(writerConfig)).toMatchSnapshot(); }); + test("strips trailing whitespace from short lines", () => { + // Spec-controlled docstrings sometimes include trailing whitespace that + // would trip Layout/TrailingWhitespace once `rubocop -A` is gone. + const docs = "If the request resulted in errors, \nadditional context here."; + const comment = ruby.comment({ docs }); + + expect(comment.toString(writerConfig)).toMatchSnapshot(); + }); + + test("emits bare `#` for blank lines in multi-line docs", () => { + const docs = "First paragraph.\n \nSecond paragraph."; + const comment = ruby.comment({ docs }); + + expect(comment.toString(writerConfig)).toMatchSnapshot(); + }); + test("handles very long words like URLs without breaking them", () => { const textWithUrl = "See the documentation at https://example.com/very/long/path/to/documentation/that/exceeds/the/line/length/limit/significantly for more information."; diff --git a/generators/ruby-v2/ast/src/ast/__test__/__snapshots__/Comment.test.ts.snap b/generators/ruby-v2/ast/src/ast/__test__/__snapshots__/Comment.test.ts.snap index 203d00426196..5df0c58e1304 100644 --- a/generators/ruby-v2/ast/src/ast/__test__/__snapshots__/Comment.test.ts.snap +++ b/generators/ruby-v2/ast/src/ast/__test__/__snapshots__/Comment.test.ts.snap @@ -2,6 +2,13 @@ exports[`Comment > does not write a comment with no content 1`] = `""`; +exports[`Comment > emits bare \`#\` for blank lines in multi-line docs 1`] = ` +"# First paragraph. +# +# Second paragraph. +" +`; + exports[`Comment > handles lines that are exactly at the limit 1`] = ` "# AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA " @@ -21,6 +28,12 @@ exports[`Comment > preserves existing line breaks while wrapping long lines 1`] " `; +exports[`Comment > strips trailing whitespace from short lines 1`] = ` +"# If the request resulted in errors, +# additional context here. +" +`; + exports[`Comment > wraps long lines to fit within RuboCop line length limit 1`] = ` "# This is a very long comment that exceeds the RuboCop default line length limit of 120 characters and should be wrapped # to multiple lines automatically. diff --git a/generators/ruby-v2/sdk/changes/unreleased/strip-comment-trailing-ws.yml b/generators/ruby-v2/sdk/changes/unreleased/strip-comment-trailing-ws.yml new file mode 100644 index 000000000000..404be769f5b7 --- /dev/null +++ b/generators/ruby-v2/sdk/changes/unreleased/strip-comment-trailing-ws.yml @@ -0,0 +1,5 @@ +- summary: | + Strip trailing whitespace from generated comment lines so spec-controlled docstrings + no longer trip `Layout/TrailingWhitespace` after the `rubocop -A` autocorrect pass + was removed in #15202. Caught on the Square nightly baseline benchmark. + type: fix From 1b98eceeda1019fade458385ac08e6819120ee26 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 17:22:45 +0000 Subject: [PATCH 34/43] chore(java): release 4.6.3 --- .../fix-list-item-wrappers-in-snippets.yml | 0 generators/java/sdk/versions.yml | 14 ++++++++++++++ 2 files changed, 14 insertions(+) rename generators/java/sdk/changes/{unreleased => 4.6.3}/fix-list-item-wrappers-in-snippets.yml (100%) diff --git a/generators/java/sdk/changes/unreleased/fix-list-item-wrappers-in-snippets.yml b/generators/java/sdk/changes/4.6.3/fix-list-item-wrappers-in-snippets.yml similarity index 100% rename from generators/java/sdk/changes/unreleased/fix-list-item-wrappers-in-snippets.yml rename to generators/java/sdk/changes/4.6.3/fix-list-item-wrappers-in-snippets.yml diff --git a/generators/java/sdk/versions.yml b/generators/java/sdk/versions.yml index d633250c360b..39218b715a2d 100644 --- a/generators/java/sdk/versions.yml +++ b/generators/java/sdk/versions.yml @@ -1,4 +1,18 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 4.6.3 + changelogEntry: + - summary: | + Fix Java SDK snippet and wire test generation for `allow-multiple` query + parameters when `coerce-optional-schemas-to-nullable: true` is set. + Previously, list items wrapped in `optional<...>` and/or `nullable<...>` + produced calls like `.strategy(Arrays.asList(Optional.of(...)))`, which + failed to compile because the generated builders only expose `List` + overloads (no `List>` or `List>`). The snippet + generator now strips both `optional` and `nullable` wrappers from list + items, so the emitted code matches an existing builder signature. + type: fix + createdAt: "2026-04-29" + irVersion: 66 - version: 4.6.2 changelogEntry: - summary: | From a3d9e9b332586edd94442c3a441c143a9cdaba1a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 17:22:52 +0000 Subject: [PATCH 35/43] chore(php): release 2.8.0 --- .../{unreleased => 2.8.0}/fix-retry-status-codes.yml | 0 generators/php/sdk/versions.yml | 10 ++++++++++ 2 files changed, 10 insertions(+) rename generators/php/sdk/changes/{unreleased => 2.8.0}/fix-retry-status-codes.yml (100%) diff --git a/generators/php/sdk/changes/unreleased/fix-retry-status-codes.yml b/generators/php/sdk/changes/2.8.0/fix-retry-status-codes.yml similarity index 100% rename from generators/php/sdk/changes/unreleased/fix-retry-status-codes.yml rename to generators/php/sdk/changes/2.8.0/fix-retry-status-codes.yml diff --git a/generators/php/sdk/versions.yml b/generators/php/sdk/versions.yml index ba0f8ca2121b..ae9d65795c15 100644 --- a/generators/php/sdk/versions.yml +++ b/generators/php/sdk/versions.yml @@ -1,4 +1,14 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 2.8.0 + changelogEntry: + - summary: | + Add `retryStatusCodes` configuration option (`legacy` | `recommended`). The default + `legacy` mode preserves existing behavior (retries 408, 429, and all >= 500). The + `recommended` mode only retries 408, 429, 502, 503, 504 (excludes 500 Internal + Server Error to avoid retrying non-idempotent failures). + type: feat + createdAt: "2026-04-29" + irVersion: 66 - version: 2.7.0 changelogEntry: - summary: | From 0230cd2035f09f3fc3a98048edcee04c83777aab Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 17:23:01 +0000 Subject: [PATCH 36/43] chore(ruby-v2): release 1.11.1 --- .../{unreleased => 1.11.1}/strip-comment-trailing-ws.yml | 0 generators/ruby-v2/sdk/versions.yml | 9 +++++++++ 2 files changed, 9 insertions(+) rename generators/ruby-v2/sdk/changes/{unreleased => 1.11.1}/strip-comment-trailing-ws.yml (100%) diff --git a/generators/ruby-v2/sdk/changes/unreleased/strip-comment-trailing-ws.yml b/generators/ruby-v2/sdk/changes/1.11.1/strip-comment-trailing-ws.yml similarity index 100% rename from generators/ruby-v2/sdk/changes/unreleased/strip-comment-trailing-ws.yml rename to generators/ruby-v2/sdk/changes/1.11.1/strip-comment-trailing-ws.yml diff --git a/generators/ruby-v2/sdk/versions.yml b/generators/ruby-v2/sdk/versions.yml index 05c63d031b01..fca9e7afda4f 100644 --- a/generators/ruby-v2/sdk/versions.yml +++ b/generators/ruby-v2/sdk/versions.yml @@ -1,4 +1,13 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 1.11.1 + changelogEntry: + - summary: | + Strip trailing whitespace from generated comment lines so spec-controlled docstrings + no longer trip `Layout/TrailingWhitespace` after the `rubocop -A` autocorrect pass + was removed in #15202. Caught on the Square nightly baseline benchmark. + type: fix + createdAt: "2026-04-29" + irVersion: 66 - version: 1.11.0 changelogEntry: - summary: | From f1b1d990e2a9cf9fae6f6ddbdb8402be9385604f Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 13:36:13 -0400 Subject: [PATCH 37/43] fix(csharp): percent-encode query param keys in WireMock test generation (#15493) * fix(csharp-sdk): add brackets to safe query key characters Add `[` and `]` to SafeQueryKeyChars so array-style query parameter names like `page[size]` are sent unencoded. Previously these were percent-encoded as `page%5Bsize%5D`, causing WireMock.Net mock server test failures when the test setup used decoded names in WithParam(). Update all seed test outputs and add a unit test for bracket preservation. Co-Authored-By: will.kendall@buildwithfern.com * fix(csharp): add brackets to IsSafeQueryKeyChar fallback for non-NET8 targets Co-Authored-By: will.kendall@buildwithfern.com * fix(csharp): update test assertions to expect unencoded brackets in query keys Co-Authored-By: will.kendall@buildwithfern.com * fix(csharp): split comma-delimited query param values for WireMock.Net matching WireMock.Net splits comma-separated query parameter values into arrays. When a query param example contains commas (e.g. 'merchant,offer'), generate separate .WithParam() calls for each value so they match correctly. Co-Authored-By: will.kendall@buildwithfern.com * fix(csharp): use single WithParam call with multiple values for comma-delimited params WireMock.Net requires all values for the same param name in a single WithParam() call. Multiple separate calls for the same key cause matcher failures. Co-Authored-By: will.kendall@buildwithfern.com * chore(csharp): add changelog entry for comma-delimited query param fix Co-Authored-By: will.kendall@buildwithfern.com * fix(csharp): escape quotes and backslashes in comma-split query param values Properly escape special characters before wrapping values in C# string literals to prevent syntax errors in generated WithParam() calls. Co-Authored-By: will.kendall@buildwithfern.com * fix(csharp): remove trim() to preserve whitespace in comma-split query values WireMock.Net preserves whitespace when splitting comma-delimited values, so trimming in the generator would cause a mismatch for values like 'foo, bar' where the space after the comma is significant. Co-Authored-By: will.kendall@buildwithfern.com * fix(csharp): percent-encode query param keys in WireMock test generation Revert the SafeQueryKeyChars change that added [ and ] to safe characters. Per RFC 3986, brackets are reserved gen-delims and must be percent-encoded. Instead, fix the test generator (MockEndpointGenerator.ts) to percent-encode query parameter key names using the same safe character set as the C# SDK's QueryStringBuilder. This ensures the WireMock matcher expects the encoded key that the spec-compliant HTTP client actually sends on the wire. Co-Authored-By: will.kendall@buildwithfern.com * fix(csharp): fix biome formatting for SAFE_QUERY_KEY_CHARS Co-Authored-By: will.kendall@buildwithfern.com --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: will.kendall@buildwithfern.com --- ...-comma-delimited-query-params-wiremock.yml | 6 ++++ .../mock-server/MockEndpointGenerator.ts | 32 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 generators/csharp/sdk/changes/unreleased/fix-comma-delimited-query-params-wiremock.yml diff --git a/generators/csharp/sdk/changes/unreleased/fix-comma-delimited-query-params-wiremock.yml b/generators/csharp/sdk/changes/unreleased/fix-comma-delimited-query-params-wiremock.yml new file mode 100644 index 000000000000..6dc1d7302597 --- /dev/null +++ b/generators/csharp/sdk/changes/unreleased/fix-comma-delimited-query-params-wiremock.yml @@ -0,0 +1,6 @@ +- summary: | + Fix WireMock test generation to use percent-encoded query parameter keys, + matching what spec-compliant HTTP clients send. Also split comma-delimited + query parameter examples into multiple values in a single `WithParam()` call, + since WireMock.Net parses comma-separated values into arrays. + type: fix diff --git a/generators/csharp/sdk/src/test-generation/mock-server/MockEndpointGenerator.ts b/generators/csharp/sdk/src/test-generation/mock-server/MockEndpointGenerator.ts index 2928941cce3f..fa00a51a74be 100644 --- a/generators/csharp/sdk/src/test-generation/mock-server/MockEndpointGenerator.ts +++ b/generators/csharp/sdk/src/test-generation/mock-server/MockEndpointGenerator.ts @@ -96,7 +96,13 @@ export class MockEndpointGenerator extends WithGeneration { for (const parameter of example.queryParameters) { const maybeParameterValue = this.exampleToQueryOrHeaderValue(parameter); if (maybeParameterValue != null) { - writer.write(`.WithParam("${getWireValue(parameter.name)}", "${maybeParameterValue}")`); + const encodedKey = percentEncodeQueryKey(getWireValue(parameter.name)); + // WireMock.Net splits comma-delimited query values into separate array + // entries, so pass all values in a single WithParam call. + const paramValues = maybeParameterValue + .split(",") + .map((v) => `"${v.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`); + writer.write(`.WithParam("${encodedKey}", ${paramValues.join(", ")})`); } } for (const header of [...example.serviceHeaders, ...example.endpointHeaders]) { @@ -973,3 +979,27 @@ export class MockEndpointGenerator extends WithGeneration { return pairs.join(", "); } } + +// Characters the C# SDK's QueryStringBuilder treats as safe for query keys. +// Mirrors: unreserved + (sub-delims \ {& = +}) + : @ / ? +// See QueryStringBuilder.Template.cs SafeQueryKeyChars. +const SAFE_QUERY_KEY_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~!$'()*,;:@/?"); + +/** + * Percent-encodes a query parameter key to match the C# SDK's QueryStringBuilder. + * Characters not in SafeQueryKeyChars are percent-encoded with uppercase hex digits. + */ +function percentEncodeQueryKey(key: string): string { + const encoder = new TextEncoder(); + let encoded = ""; + for (const char of key) { + if (SAFE_QUERY_KEY_CHARS.has(char)) { + encoded += char; + } else { + for (const byte of encoder.encode(char)) { + encoded += `%${byte.toString(16).toUpperCase().padStart(2, "0")}`; + } + } + } + return encoded; +} From 59418e3dd65bc00cc670ff2380918d0e7bc2f17c Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 13:36:53 -0400 Subject: [PATCH 38/43] chore(python): update python-sdk seed (#15584) --- .../exhaustive/deps_with_min_python_version/poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seed/python-sdk/exhaustive/deps_with_min_python_version/poetry.lock b/seed/python-sdk/exhaustive/deps_with_min_python_version/poetry.lock index 1a3c31ea1e0a..091948bf58a0 100644 --- a/seed/python-sdk/exhaustive/deps_with_min_python_version/poetry.lock +++ b/seed/python-sdk/exhaustive/deps_with_min_python_version/poetry.lock @@ -952,13 +952,13 @@ tiktoken = ">=0.7.0,<1.0.0" [[package]] name = "langchain-protocol" -version = "0.0.13" +version = "0.0.14" description = "Python bindings for the LangChain agent streaming protocol" optional = false python-versions = "<4.0.0,>=3.10.0" files = [ - {file = "langchain_protocol-0.0.13-py3-none-any.whl", hash = "sha256:47d4f2a05827bf3a66b238082bf59e8313fd3a14e1b268bdd65c85b67a6b1f6c"}, - {file = "langchain_protocol-0.0.13.tar.gz", hash = "sha256:7448ca507407a6aaa28a73884d74765540e65da891a14a6e062a196412bc554c"}, + {file = "langchain_protocol-0.0.14-py3-none-any.whl", hash = "sha256:ffc35089779bd8ca217015180cef5e660fc3b074efdaa0f2e95df73583f1a047"}, + {file = "langchain_protocol-0.0.14.tar.gz", hash = "sha256:bc1e8553122e6ede310280462d5813023a172ff2785ccbbdec54d43f3a15e5f2"}, ] [package.dependencies] From 068e3b8853a8c9f52f3e48db1155bcf55f097ffb Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 13:38:04 -0400 Subject: [PATCH 39/43] chore(java): update java-sdk seed (#15586) From 49348e2910c07aea25fe89b3fa110078af550678 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Wed, 29 Apr 2026 13:38:31 -0400 Subject: [PATCH 40/43] chore(php): update php-sdk seed (#15585) From f41de818d3c576880c625f4df95d6c4982248c1b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 17:40:24 +0000 Subject: [PATCH 41/43] chore(csharp): release 2.63.1 --- .../fix-comma-delimited-query-params-wiremock.yml | 0 generators/csharp/sdk/versions.yml | 10 ++++++++++ 2 files changed, 10 insertions(+) rename generators/csharp/sdk/changes/{unreleased => 2.63.1}/fix-comma-delimited-query-params-wiremock.yml (100%) diff --git a/generators/csharp/sdk/changes/unreleased/fix-comma-delimited-query-params-wiremock.yml b/generators/csharp/sdk/changes/2.63.1/fix-comma-delimited-query-params-wiremock.yml similarity index 100% rename from generators/csharp/sdk/changes/unreleased/fix-comma-delimited-query-params-wiremock.yml rename to generators/csharp/sdk/changes/2.63.1/fix-comma-delimited-query-params-wiremock.yml diff --git a/generators/csharp/sdk/versions.yml b/generators/csharp/sdk/versions.yml index 363f178fe9aa..6f43ed7dc029 100644 --- a/generators/csharp/sdk/versions.yml +++ b/generators/csharp/sdk/versions.yml @@ -1,4 +1,14 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 2.63.1 + changelogEntry: + - summary: | + Fix WireMock test generation to use percent-encoded query parameter keys, + matching what spec-compliant HTTP clients send. Also split comma-delimited + query parameter examples into multiple values in a single `WithParam()` call, + since WireMock.Net parses comma-separated values into arrays. + type: fix + createdAt: "2026-04-29" + irVersion: 66 - version: 2.63.0 changelogEntry: - summary: | From 3574abeaae365044069b7951347f506004750264 Mon Sep 17 00:00:00 2001 From: patrick thornton <70873350+patrickthornton@users.noreply.github.com> Date: Wed, 29 Apr 2026 13:41:52 -0400 Subject: [PATCH 42/43] fix(csharp): avoid list-of-list wrap for already-list query param examples (#15569) --- ...alue-query-param-list-example-snippets.yml | 6 ++++++ .../WrappedRequestGenerator.ts | 21 +++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 generators/csharp/sdk/changes/unreleased/fix-multivalue-query-param-list-example-snippets.yml diff --git a/generators/csharp/sdk/changes/unreleased/fix-multivalue-query-param-list-example-snippets.yml b/generators/csharp/sdk/changes/unreleased/fix-multivalue-query-param-list-example-snippets.yml new file mode 100644 index 000000000000..1a4d42af9712 --- /dev/null +++ b/generators/csharp/sdk/changes/unreleased/fix-multivalue-query-param-list-example-snippets.yml @@ -0,0 +1,6 @@ +- summary: | + Fix multi-value query parameter snippets when the example value is already + a list, which previously produced uncompilable list-of-list initializers + like `[new List() { value }]` in mock server tests, reference docs, and + snippets. + type: fix diff --git a/generators/csharp/sdk/src/wrapped-request/WrappedRequestGenerator.ts b/generators/csharp/sdk/src/wrapped-request/WrappedRequestGenerator.ts index 16bbb1bf6fa0..fa3cca415f6a 100644 --- a/generators/csharp/sdk/src/wrapped-request/WrappedRequestGenerator.ts +++ b/generators/csharp/sdk/src/wrapped-request/WrappedRequestGenerator.ts @@ -331,19 +331,22 @@ export class WrappedRequestGenerator extends FileGenerator - writer.writeNode( - this.csharp.list({ - entries: [singleValueSnippet] - }) - ) - ); + const value = + isSingleQueryParameter || isExampleAlreadyList + ? singleValueSnippet + : this.csharp.codeblock((writer: Writer) => + writer.writeNode( + this.csharp.list({ + entries: [singleValueSnippet] + }) + ) + ); orderedFields.push({ name: exampleQueryParameter.name, value From 41251fe22c9a23866660bf59e2c61fb19f5e59c2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 17:50:13 +0000 Subject: [PATCH 43/43] chore(csharp): release 2.63.2 --- ...ix-multivalue-query-param-list-example-snippets.yml | 0 generators/csharp/sdk/versions.yml | 10 ++++++++++ 2 files changed, 10 insertions(+) rename generators/csharp/sdk/changes/{unreleased => 2.63.2}/fix-multivalue-query-param-list-example-snippets.yml (100%) diff --git a/generators/csharp/sdk/changes/unreleased/fix-multivalue-query-param-list-example-snippets.yml b/generators/csharp/sdk/changes/2.63.2/fix-multivalue-query-param-list-example-snippets.yml similarity index 100% rename from generators/csharp/sdk/changes/unreleased/fix-multivalue-query-param-list-example-snippets.yml rename to generators/csharp/sdk/changes/2.63.2/fix-multivalue-query-param-list-example-snippets.yml diff --git a/generators/csharp/sdk/versions.yml b/generators/csharp/sdk/versions.yml index 6f43ed7dc029..86ea0ac81036 100644 --- a/generators/csharp/sdk/versions.yml +++ b/generators/csharp/sdk/versions.yml @@ -1,4 +1,14 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 2.63.2 + changelogEntry: + - summary: | + Fix multi-value query parameter snippets when the example value is already + a list, which previously produced uncompilable list-of-list initializers + like `[new List() { value }]` in mock server tests, reference docs, and + snippets. + type: fix + createdAt: "2026-04-29" + irVersion: 66 - version: 2.63.1 changelogEntry: - summary: |