diff --git a/templates/base/http-clients/fetch-http-client.ejs b/templates/base/http-clients/fetch-http-client.ejs index 708937fc..a1db3833 100644 --- a/templates/base/http-clients/fetch-http-client.ejs +++ b/templates/base/http-clients/fetch-http-client.ejs @@ -189,7 +189,7 @@ export class HttpClient { body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), } ).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = (null as unknown) as T; r.error = (null as unknown) as E; diff --git a/tests/generated/v2.0/adafruit.ts b/tests/generated/v2.0/adafruit.ts index 844734e4..7be62365 100644 --- a/tests/generated/v2.0/adafruit.ts +++ b/tests/generated/v2.0/adafruit.ts @@ -346,7 +346,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/another-example.ts b/tests/generated/v2.0/another-example.ts index 15b67a4f..e87e75d6 100644 --- a/tests/generated/v2.0/another-example.ts +++ b/tests/generated/v2.0/another-example.ts @@ -322,7 +322,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/another-schema.ts b/tests/generated/v2.0/another-schema.ts index 31429074..9520976d 100644 --- a/tests/generated/v2.0/another-schema.ts +++ b/tests/generated/v2.0/another-schema.ts @@ -210,7 +210,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/api-with-examples.ts b/tests/generated/v2.0/api-with-examples.ts index 26b1bda1..0a830375 100644 --- a/tests/generated/v2.0/api-with-examples.ts +++ b/tests/generated/v2.0/api-with-examples.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/authentiq.ts b/tests/generated/v2.0/authentiq.ts index 83b1860f..4b760c36 100644 --- a/tests/generated/v2.0/authentiq.ts +++ b/tests/generated/v2.0/authentiq.ts @@ -229,7 +229,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/enums.ts b/tests/generated/v2.0/enums.ts index dd34c8fa..0a1b16d2 100644 --- a/tests/generated/v2.0/enums.ts +++ b/tests/generated/v2.0/enums.ts @@ -248,7 +248,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/example1.ts b/tests/generated/v2.0/example1.ts index 70408faf..bae0a69c 100644 --- a/tests/generated/v2.0/example1.ts +++ b/tests/generated/v2.0/example1.ts @@ -226,7 +226,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/file-formdata-example.ts b/tests/generated/v2.0/file-formdata-example.ts index 0edb5c57..8c14477a 100644 --- a/tests/generated/v2.0/file-formdata-example.ts +++ b/tests/generated/v2.0/file-formdata-example.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/furkot-example.ts b/tests/generated/v2.0/furkot-example.ts index 6eb84008..9e6b9f0a 100644 --- a/tests/generated/v2.0/furkot-example.ts +++ b/tests/generated/v2.0/furkot-example.ts @@ -262,7 +262,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/giphy.ts b/tests/generated/v2.0/giphy.ts index 6c497f4e..e3be8b63 100644 --- a/tests/generated/v2.0/giphy.ts +++ b/tests/generated/v2.0/giphy.ts @@ -446,7 +446,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/github-swagger.ts b/tests/generated/v2.0/github-swagger.ts index c9dec236..d66f30d4 100644 --- a/tests/generated/v2.0/github-swagger.ts +++ b/tests/generated/v2.0/github-swagger.ts @@ -2087,7 +2087,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/path-args.ts b/tests/generated/v2.0/path-args.ts index 8f47fa21..e8c521c6 100644 --- a/tests/generated/v2.0/path-args.ts +++ b/tests/generated/v2.0/path-args.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/petstore-expanded.ts b/tests/generated/v2.0/petstore-expanded.ts index f426f787..f903f774 100644 --- a/tests/generated/v2.0/petstore-expanded.ts +++ b/tests/generated/v2.0/petstore-expanded.ts @@ -225,7 +225,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/petstore-minimal.ts b/tests/generated/v2.0/petstore-minimal.ts index 46919f31..618242fb 100644 --- a/tests/generated/v2.0/petstore-minimal.ts +++ b/tests/generated/v2.0/petstore-minimal.ts @@ -197,7 +197,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/petstore-simple.ts b/tests/generated/v2.0/petstore-simple.ts index 9220014b..952bd81f 100644 --- a/tests/generated/v2.0/petstore-simple.ts +++ b/tests/generated/v2.0/petstore-simple.ts @@ -213,7 +213,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/petstore-swagger-io.ts b/tests/generated/v2.0/petstore-swagger-io.ts index 76363c66..a4a4ddb0 100644 --- a/tests/generated/v2.0/petstore-swagger-io.ts +++ b/tests/generated/v2.0/petstore-swagger-io.ts @@ -250,7 +250,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/petstore-with-external-docs.ts b/tests/generated/v2.0/petstore-with-external-docs.ts index 2b10dcc6..902d064b 100644 --- a/tests/generated/v2.0/petstore-with-external-docs.ts +++ b/tests/generated/v2.0/petstore-with-external-docs.ts @@ -205,7 +205,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/petstore.ts b/tests/generated/v2.0/petstore.ts index 926c3663..1a517200 100644 --- a/tests/generated/v2.0/petstore.ts +++ b/tests/generated/v2.0/petstore.ts @@ -204,7 +204,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/query-path-param.ts b/tests/generated/v2.0/query-path-param.ts index fdf22c81..24c57b78 100644 --- a/tests/generated/v2.0/query-path-param.ts +++ b/tests/generated/v2.0/query-path-param.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v2.0/uber.ts b/tests/generated/v2.0/uber.ts index 4ad1962f..68597934 100644 --- a/tests/generated/v2.0/uber.ts +++ b/tests/generated/v2.0/uber.ts @@ -268,7 +268,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/additional-properties.ts b/tests/generated/v3.0/additional-properties.ts index fd587e8a..bbf18d8f 100644 --- a/tests/generated/v3.0/additional-properties.ts +++ b/tests/generated/v3.0/additional-properties.ts @@ -196,7 +196,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/additional-properties2.ts b/tests/generated/v3.0/additional-properties2.ts index d2afa478..84c93361 100644 --- a/tests/generated/v3.0/additional-properties2.ts +++ b/tests/generated/v3.0/additional-properties2.ts @@ -193,7 +193,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/allof-example.ts b/tests/generated/v3.0/allof-example.ts index 381293e6..8574e2ff 100644 --- a/tests/generated/v3.0/allof-example.ts +++ b/tests/generated/v3.0/allof-example.ts @@ -203,7 +203,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/anyof-example.ts b/tests/generated/v3.0/anyof-example.ts index 284e66f2..7b952cdd 100644 --- a/tests/generated/v3.0/anyof-example.ts +++ b/tests/generated/v3.0/anyof-example.ts @@ -199,7 +199,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/api-with-examples.ts b/tests/generated/v3.0/api-with-examples.ts index c60c1c46..af498c48 100644 --- a/tests/generated/v3.0/api-with-examples.ts +++ b/tests/generated/v3.0/api-with-examples.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/callback-example.ts b/tests/generated/v3.0/callback-example.ts index 0421e267..7ea2467f 100644 --- a/tests/generated/v3.0/callback-example.ts +++ b/tests/generated/v3.0/callback-example.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/components-responses.ts b/tests/generated/v3.0/components-responses.ts index 57cecc9a..bb72ddfd 100644 --- a/tests/generated/v3.0/components-responses.ts +++ b/tests/generated/v3.0/components-responses.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/explode-param-3.0.1.ts b/tests/generated/v3.0/explode-param-3.0.1.ts index c395698c..b3c020cb 100644 --- a/tests/generated/v3.0/explode-param-3.0.1.ts +++ b/tests/generated/v3.0/explode-param-3.0.1.ts @@ -208,7 +208,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/full-swagger-scheme.ts b/tests/generated/v3.0/full-swagger-scheme.ts index fda7129d..4b6cb5ab 100644 --- a/tests/generated/v3.0/full-swagger-scheme.ts +++ b/tests/generated/v3.0/full-swagger-scheme.ts @@ -8813,7 +8813,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/link-example.ts b/tests/generated/v3.0/link-example.ts index cff138d0..127cd943 100644 --- a/tests/generated/v3.0/link-example.ts +++ b/tests/generated/v3.0/link-example.ts @@ -206,7 +206,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/no-definitions-schema.ts b/tests/generated/v3.0/no-definitions-schema.ts index c04a43f2..6ae05ba1 100644 --- a/tests/generated/v3.0/no-definitions-schema.ts +++ b/tests/generated/v3.0/no-definitions-schema.ts @@ -203,7 +203,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/oneof-example.ts b/tests/generated/v3.0/oneof-example.ts index aef9b257..5621d729 100644 --- a/tests/generated/v3.0/oneof-example.ts +++ b/tests/generated/v3.0/oneof-example.ts @@ -199,7 +199,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/personal-api-example.ts b/tests/generated/v3.0/personal-api-example.ts index 02f8baf9..1e9454bc 100644 --- a/tests/generated/v3.0/personal-api-example.ts +++ b/tests/generated/v3.0/personal-api-example.ts @@ -374,7 +374,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/petstore-expanded.ts b/tests/generated/v3.0/petstore-expanded.ts index 3ee78d21..26ac904a 100644 --- a/tests/generated/v3.0/petstore-expanded.ts +++ b/tests/generated/v3.0/petstore-expanded.ts @@ -205,7 +205,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/petstore.ts b/tests/generated/v3.0/petstore.ts index 7a5feb90..7ac4b9ef 100644 --- a/tests/generated/v3.0/petstore.ts +++ b/tests/generated/v3.0/petstore.ts @@ -206,7 +206,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/recursive-schema.ts b/tests/generated/v3.0/recursive-schema.ts index 93f8060c..681923e1 100644 --- a/tests/generated/v3.0/recursive-schema.ts +++ b/tests/generated/v3.0/recursive-schema.ts @@ -200,7 +200,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/responses.ts b/tests/generated/v3.0/responses.ts index a4877d80..e192574f 100644 --- a/tests/generated/v3.0/responses.ts +++ b/tests/generated/v3.0/responses.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/swaggerhub-template.ts b/tests/generated/v3.0/swaggerhub-template.ts index 2a3656f9..d84b0fbd 100644 --- a/tests/generated/v3.0/swaggerhub-template.ts +++ b/tests/generated/v3.0/swaggerhub-template.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts b/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts index c2d5151d..f1b9f054 100644 --- a/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts +++ b/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts @@ -300,7 +300,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/up-banking.ts b/tests/generated/v3.0/up-banking.ts index 63d41120..d4e8d26a 100644 --- a/tests/generated/v3.0/up-banking.ts +++ b/tests/generated/v3.0/up-banking.ts @@ -931,7 +931,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/uspto.ts b/tests/generated/v3.0/uspto.ts index 411912f4..e93ddeeb 100644 --- a/tests/generated/v3.0/uspto.ts +++ b/tests/generated/v3.0/uspto.ts @@ -221,7 +221,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/wrong-enum-subtypes.ts b/tests/generated/v3.0/wrong-enum-subtypes.ts index dd574c08..8ce02cf0 100644 --- a/tests/generated/v3.0/wrong-enum-subtypes.ts +++ b/tests/generated/v3.0/wrong-enum-subtypes.ts @@ -195,7 +195,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/generated/v3.0/wrong-schema-names.ts b/tests/generated/v3.0/wrong-schema-names.ts index a5f2a569..cb66d710 100644 --- a/tests/generated/v3.0/wrong-schema-names.ts +++ b/tests/generated/v3.0/wrong-schema-names.ts @@ -213,7 +213,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/another-query-params/expected.ts b/tests/spec/another-query-params/expected.ts index 82b22125..52df16d0 100644 --- a/tests/spec/another-query-params/expected.ts +++ b/tests/spec/another-query-params/expected.ts @@ -217,7 +217,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/another-query-params/schema.ts b/tests/spec/another-query-params/schema.ts index 82b22125..52df16d0 100644 --- a/tests/spec/another-query-params/schema.ts +++ b/tests/spec/another-query-params/schema.ts @@ -217,7 +217,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/cli/expected.ts b/tests/spec/cli/expected.ts index c5a5f5e1..1b0dcb52 100644 --- a/tests/spec/cli/expected.ts +++ b/tests/spec/cli/expected.ts @@ -334,7 +334,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/cli/schema.ts b/tests/spec/cli/schema.ts index c5a5f5e1..1b0dcb52 100644 --- a/tests/spec/cli/schema.ts +++ b/tests/spec/cli/schema.ts @@ -334,7 +334,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/defaultAsSuccess/expected.ts b/tests/spec/defaultAsSuccess/expected.ts index a7a68d96..682abf15 100644 --- a/tests/spec/defaultAsSuccess/expected.ts +++ b/tests/spec/defaultAsSuccess/expected.ts @@ -229,7 +229,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/defaultAsSuccess/schema.ts b/tests/spec/defaultAsSuccess/schema.ts index a7a68d96..682abf15 100644 --- a/tests/spec/defaultAsSuccess/schema.ts +++ b/tests/spec/defaultAsSuccess/schema.ts @@ -229,7 +229,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/defaultResponse/expected.ts b/tests/spec/defaultResponse/expected.ts index 98692571..4962293d 100644 --- a/tests/spec/defaultResponse/expected.ts +++ b/tests/spec/defaultResponse/expected.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/defaultResponse/schema.ts b/tests/spec/defaultResponse/schema.ts index 98692571..4962293d 100644 --- a/tests/spec/defaultResponse/schema.ts +++ b/tests/spec/defaultResponse/schema.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/deprecated/expected.ts b/tests/spec/deprecated/expected.ts index fe1a8c3d..22767595 100644 --- a/tests/spec/deprecated/expected.ts +++ b/tests/spec/deprecated/expected.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/deprecated/schema.ts b/tests/spec/deprecated/schema.ts index fe1a8c3d..22767595 100644 --- a/tests/spec/deprecated/schema.ts +++ b/tests/spec/deprecated/schema.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/dot-path-params/expected.ts b/tests/spec/dot-path-params/expected.ts index dee48d60..fc274dd7 100644 --- a/tests/spec/dot-path-params/expected.ts +++ b/tests/spec/dot-path-params/expected.ts @@ -191,7 +191,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/dot-path-params/schema.ts b/tests/spec/dot-path-params/schema.ts index dee48d60..fc274dd7 100644 --- a/tests/spec/dot-path-params/schema.ts +++ b/tests/spec/dot-path-params/schema.ts @@ -191,7 +191,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/enumNamesAsValues/expected.ts b/tests/spec/enumNamesAsValues/expected.ts index a542b0c3..b08dca68 100644 --- a/tests/spec/enumNamesAsValues/expected.ts +++ b/tests/spec/enumNamesAsValues/expected.ts @@ -381,7 +381,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/enumNamesAsValues/schema.ts b/tests/spec/enumNamesAsValues/schema.ts index a542b0c3..b08dca68 100644 --- a/tests/spec/enumNamesAsValues/schema.ts +++ b/tests/spec/enumNamesAsValues/schema.ts @@ -381,7 +381,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/extractRequestBody/expected.ts b/tests/spec/extractRequestBody/expected.ts index 75449a8b..2a26c8e7 100644 --- a/tests/spec/extractRequestBody/expected.ts +++ b/tests/spec/extractRequestBody/expected.ts @@ -342,7 +342,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/extractRequestBody/schema.ts b/tests/spec/extractRequestBody/schema.ts index 75449a8b..2a26c8e7 100644 --- a/tests/spec/extractRequestBody/schema.ts +++ b/tests/spec/extractRequestBody/schema.ts @@ -342,7 +342,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/extractRequestParams/expected.ts b/tests/spec/extractRequestParams/expected.ts index 914ae447..08b222e0 100644 --- a/tests/spec/extractRequestParams/expected.ts +++ b/tests/spec/extractRequestParams/expected.ts @@ -264,7 +264,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/extractRequestParams/schema.ts b/tests/spec/extractRequestParams/schema.ts index 914ae447..08b222e0 100644 --- a/tests/spec/extractRequestParams/schema.ts +++ b/tests/spec/extractRequestParams/schema.ts @@ -264,7 +264,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/extractResponseBody/expected.ts b/tests/spec/extractResponseBody/expected.ts index 66af5c43..6ac2fc9e 100644 --- a/tests/spec/extractResponseBody/expected.ts +++ b/tests/spec/extractResponseBody/expected.ts @@ -344,7 +344,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/extractResponseBody/schema.ts b/tests/spec/extractResponseBody/schema.ts index 66af5c43..6ac2fc9e 100644 --- a/tests/spec/extractResponseBody/schema.ts +++ b/tests/spec/extractResponseBody/schema.ts @@ -344,7 +344,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/extractResponseError/expected.ts b/tests/spec/extractResponseError/expected.ts index 54eab4ab..c7c17373 100644 --- a/tests/spec/extractResponseError/expected.ts +++ b/tests/spec/extractResponseError/expected.ts @@ -339,7 +339,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/extractResponseError/schema.ts b/tests/spec/extractResponseError/schema.ts index 54eab4ab..c7c17373 100644 --- a/tests/spec/extractResponseError/schema.ts +++ b/tests/spec/extractResponseError/schema.ts @@ -339,7 +339,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/js/schema.js b/tests/spec/js/schema.js index 4ce1a9a0..b023cd0d 100644 --- a/tests/spec/js/schema.js +++ b/tests/spec/js/schema.js @@ -125,7 +125,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response; + const r = response.clone(); r.data = null; r.error = null; const data = !responseFormat diff --git a/tests/spec/jsSingleHttpClientModular/expected/http-client.js b/tests/spec/jsSingleHttpClientModular/expected/http-client.js index e2ed3868..337c65e4 100644 --- a/tests/spec/jsSingleHttpClientModular/expected/http-client.js +++ b/tests/spec/jsSingleHttpClientModular/expected/http-client.js @@ -125,7 +125,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response; + const r = response.clone(); r.data = null; r.error = null; const data = !responseFormat diff --git a/tests/spec/jsSingleHttpClientModular/generated/http-client.js b/tests/spec/jsSingleHttpClientModular/generated/http-client.js index e2ed3868..337c65e4 100644 --- a/tests/spec/jsSingleHttpClientModular/generated/http-client.js +++ b/tests/spec/jsSingleHttpClientModular/generated/http-client.js @@ -125,7 +125,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response; + const r = response.clone(); r.data = null; r.error = null; const data = !responseFormat diff --git a/tests/spec/modular/expected/http-client.ts b/tests/spec/modular/expected/http-client.ts index 2ae54666..ed2aebb7 100644 --- a/tests/spec/modular/expected/http-client.ts +++ b/tests/spec/modular/expected/http-client.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/modular/generated/http-client.ts b/tests/spec/modular/generated/http-client.ts index 2ae54666..ed2aebb7 100644 --- a/tests/spec/modular/generated/http-client.ts +++ b/tests/spec/modular/generated/http-client.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/moduleNameFirstTag/expected.ts b/tests/spec/moduleNameFirstTag/expected.ts index 8235d1fd..e6b7c5d4 100644 --- a/tests/spec/moduleNameFirstTag/expected.ts +++ b/tests/spec/moduleNameFirstTag/expected.ts @@ -314,7 +314,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/moduleNameFirstTag/schema.ts b/tests/spec/moduleNameFirstTag/schema.ts index 8235d1fd..e6b7c5d4 100644 --- a/tests/spec/moduleNameFirstTag/schema.ts +++ b/tests/spec/moduleNameFirstTag/schema.ts @@ -314,7 +314,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/moduleNameIndex/expected.ts b/tests/spec/moduleNameIndex/expected.ts index 6c75412c..82e4a607 100644 --- a/tests/spec/moduleNameIndex/expected.ts +++ b/tests/spec/moduleNameIndex/expected.ts @@ -314,7 +314,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/moduleNameIndex/schema.ts b/tests/spec/moduleNameIndex/schema.ts index 6c75412c..82e4a607 100644 --- a/tests/spec/moduleNameIndex/schema.ts +++ b/tests/spec/moduleNameIndex/schema.ts @@ -314,7 +314,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/on-insert-path-param/expected.ts b/tests/spec/on-insert-path-param/expected.ts index 7acc3dd0..e0a7d5d0 100644 --- a/tests/spec/on-insert-path-param/expected.ts +++ b/tests/spec/on-insert-path-param/expected.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/on-insert-path-param/schema.ts b/tests/spec/on-insert-path-param/schema.ts index 7acc3dd0..e0a7d5d0 100644 --- a/tests/spec/on-insert-path-param/schema.ts +++ b/tests/spec/on-insert-path-param/schema.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/partialBaseTemplate/expected.ts b/tests/spec/partialBaseTemplate/expected.ts index 2e0ba9dc..eb2391ed 100644 --- a/tests/spec/partialBaseTemplate/expected.ts +++ b/tests/spec/partialBaseTemplate/expected.ts @@ -201,7 +201,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/partialBaseTemplate/schema.ts b/tests/spec/partialBaseTemplate/schema.ts index 2e0ba9dc..eb2391ed 100644 --- a/tests/spec/partialBaseTemplate/schema.ts +++ b/tests/spec/partialBaseTemplate/schema.ts @@ -201,7 +201,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/partialDefaultTemplate/expected.ts b/tests/spec/partialDefaultTemplate/expected.ts index e82921da..c12ca39d 100644 --- a/tests/spec/partialDefaultTemplate/expected.ts +++ b/tests/spec/partialDefaultTemplate/expected.ts @@ -197,7 +197,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/partialDefaultTemplate/schema.ts b/tests/spec/partialDefaultTemplate/schema.ts index e82921da..c12ca39d 100644 --- a/tests/spec/partialDefaultTemplate/schema.ts +++ b/tests/spec/partialDefaultTemplate/schema.ts @@ -197,7 +197,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/patch/expected.ts b/tests/spec/patch/expected.ts index 3136096d..fd49a427 100644 --- a/tests/spec/patch/expected.ts +++ b/tests/spec/patch/expected.ts @@ -1946,7 +1946,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/patch/schema.ts b/tests/spec/patch/schema.ts index 3136096d..fd49a427 100644 --- a/tests/spec/patch/schema.ts +++ b/tests/spec/patch/schema.ts @@ -1946,7 +1946,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/responses/expected.ts b/tests/spec/responses/expected.ts index b8ed658f..d8cb1e97 100644 --- a/tests/spec/responses/expected.ts +++ b/tests/spec/responses/expected.ts @@ -229,7 +229,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/responses/schema.ts b/tests/spec/responses/schema.ts index b8ed658f..d8cb1e97 100644 --- a/tests/spec/responses/schema.ts +++ b/tests/spec/responses/schema.ts @@ -229,7 +229,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/singleHttpClient/expected.ts b/tests/spec/singleHttpClient/expected.ts index 9473c156..50362b5e 100644 --- a/tests/spec/singleHttpClient/expected.ts +++ b/tests/spec/singleHttpClient/expected.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/singleHttpClient/schema.ts b/tests/spec/singleHttpClient/schema.ts index 9473c156..50362b5e 100644 --- a/tests/spec/singleHttpClient/schema.ts +++ b/tests/spec/singleHttpClient/schema.ts @@ -189,7 +189,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/sortTypes-false/expected.ts b/tests/spec/sortTypes-false/expected.ts index 029b2db0..0bfe0161 100644 --- a/tests/spec/sortTypes-false/expected.ts +++ b/tests/spec/sortTypes-false/expected.ts @@ -1946,7 +1946,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/sortTypes-false/schema.ts b/tests/spec/sortTypes-false/schema.ts index 029b2db0..0bfe0161 100644 --- a/tests/spec/sortTypes-false/schema.ts +++ b/tests/spec/sortTypes-false/schema.ts @@ -1946,7 +1946,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/sortTypes/expected.ts b/tests/spec/sortTypes/expected.ts index 0cfd055e..4587ef32 100644 --- a/tests/spec/sortTypes/expected.ts +++ b/tests/spec/sortTypes/expected.ts @@ -1946,7 +1946,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/sortTypes/schema.ts b/tests/spec/sortTypes/schema.ts index 0cfd055e..4587ef32 100644 --- a/tests/spec/sortTypes/schema.ts +++ b/tests/spec/sortTypes/schema.ts @@ -1946,7 +1946,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/templates/expected.ts b/tests/spec/templates/expected.ts index b2ff6fb2..06022066 100644 --- a/tests/spec/templates/expected.ts +++ b/tests/spec/templates/expected.ts @@ -2095,7 +2095,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/templates/schema.ts b/tests/spec/templates/schema.ts index b2ff6fb2..06022066 100644 --- a/tests/spec/templates/schema.ts +++ b/tests/spec/templates/schema.ts @@ -2095,7 +2095,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/typeSuffixPrefix/expected.ts b/tests/spec/typeSuffixPrefix/expected.ts index f27af6ec..01f6f8d8 100644 --- a/tests/spec/typeSuffixPrefix/expected.ts +++ b/tests/spec/typeSuffixPrefix/expected.ts @@ -1946,7 +1946,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/typeSuffixPrefix/schema.ts b/tests/spec/typeSuffixPrefix/schema.ts index f27af6ec..01f6f8d8 100644 --- a/tests/spec/typeSuffixPrefix/schema.ts +++ b/tests/spec/typeSuffixPrefix/schema.ts @@ -1946,7 +1946,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/unionEnums/expected.ts b/tests/spec/unionEnums/expected.ts index 55bfc0a2..d0b750f5 100644 --- a/tests/spec/unionEnums/expected.ts +++ b/tests/spec/unionEnums/expected.ts @@ -201,7 +201,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; diff --git a/tests/spec/unionEnums/schema.ts b/tests/spec/unionEnums/schema.ts index 55bfc0a2..d0b750f5 100644 --- a/tests/spec/unionEnums/schema.ts +++ b/tests/spec/unionEnums/schema.ts @@ -201,7 +201,7 @@ export class HttpClient { signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { - const r = response as HttpResponse; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E;