Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Feb 22, 2024
1 parent 11f38e7 commit 9ddc3fc
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 30 deletions.
12 changes: 9 additions & 3 deletions __test__/3.0/LDFCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3426,7 +3426,7 @@ export class Runtime implements IRuntime {
// @ts-ignore ignore error
this[method] = (url: string, config?: IRuntimeRequestCommonOptions = {}) => {
return this.request({
method: method.toUpperCase(),
method: method.toUpperCase() as Uppercase<string>,
url,
...config,
});
Expand Down Expand Up @@ -3513,8 +3513,14 @@ export class Runtime implements IRuntime {
if (config.query) {
for (const key in config.query) {
const value = config.query[key];
if (value !== undefined) {
url.searchParams.append(key, value);
if (value !== undefined && value !== null) {
if (Object.prototype.toString.call(value) === '[object Object]') {
url.searchParams.append(key, JSON.stringify(value));
} else if (Array.isArray(value)) {
value.forEach(v => url.searchParams.append(key, v))
} else {
url.searchParams.append(key, value);
}
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions __test__/3.0/Petstore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export class Runtime implements IRuntime {
// @ts-ignore ignore error
this[method] = (url: string, config?: IRuntimeRequestCommonOptions = {}) => {
return this.request({
method: method.toUpperCase(),
method: method.toUpperCase() as Uppercase<string>,
url,
...config,
});
Expand Down Expand Up @@ -483,8 +483,14 @@ export class Runtime implements IRuntime {
if (config.query) {
for (const key in config.query) {
const value = config.query[key];
if (value !== undefined) {
url.searchParams.append(key, value);
if (value !== undefined && value !== null) {
if (Object.prototype.toString.call(value) === '[object Object]') {
url.searchParams.append(key, JSON.stringify(value));
} else if (Array.isArray(value)) {
value.forEach(v => url.searchParams.append(key, v))
} else {
url.searchParams.append(key, value);
}
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions __test__/3.0/api-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export class Runtime implements IRuntime {
// @ts-ignore ignore error
this[method] = (url: string, config?: IRuntimeRequestCommonOptions = {}) => {
return this.request({
method: method.toUpperCase(),
method: method.toUpperCase() as Uppercase<string>,
url,
...config,
});
Expand Down Expand Up @@ -359,8 +359,14 @@ export class Runtime implements IRuntime {
if (config.query) {
for (const key in config.query) {
const value = config.query[key];
if (value !== undefined) {
url.searchParams.append(key, value);
if (value !== undefined && value !== null) {
if (Object.prototype.toString.call(value) === '[object Object]') {
url.searchParams.append(key, JSON.stringify(value));
} else if (Array.isArray(value)) {
value.forEach(v => url.searchParams.append(key, v))
} else {
url.searchParams.append(key, value);
}
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions __test__/3.0/api-upms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ export class Runtime implements IRuntime {
// @ts-ignore ignore error
this[method] = (url: string, config?: IRuntimeRequestCommonOptions = {}) => {
return this.request({
method: method.toUpperCase(),
method: method.toUpperCase() as Uppercase<string>,
url,
...config,
});
Expand Down Expand Up @@ -574,8 +574,14 @@ export class Runtime implements IRuntime {
if (config.query) {
for (const key in config.query) {
const value = config.query[key];
if (value !== undefined) {
url.searchParams.append(key, value);
if (value !== undefined && value !== null) {
if (Object.prototype.toString.call(value) === '[object Object]') {
url.searchParams.append(key, JSON.stringify(value));
} else if (Array.isArray(value)) {
value.forEach(v => url.searchParams.append(key, v))
} else {
url.searchParams.append(key, value);
}
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions __test__/3.0/api-with-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export class Runtime implements IRuntime {
// @ts-ignore ignore error
this[method] = (url: string, config?: IRuntimeRequestCommonOptions = {}) => {
return this.request({
method: method.toUpperCase(),
method: method.toUpperCase() as Uppercase<string>,
url,
...config,
});
Expand Down Expand Up @@ -280,8 +280,14 @@ export class Runtime implements IRuntime {
if (config.query) {
for (const key in config.query) {
const value = config.query[key];
if (value !== undefined) {
url.searchParams.append(key, value);
if (value !== undefined && value !== null) {
if (Object.prototype.toString.call(value) === '[object Object]') {
url.searchParams.append(key, JSON.stringify(value));
} else if (Array.isArray(value)) {
value.forEach(v => url.searchParams.append(key, v))
} else {
url.searchParams.append(key, value);
}
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions __test__/3.0/callback-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class Runtime implements IRuntime {
// @ts-ignore ignore error
this[method] = (url: string, config?: IRuntimeRequestCommonOptions = {}) => {
return this.request({
method: method.toUpperCase(),
method: method.toUpperCase() as Uppercase<string>,
url,
...config,
});
Expand Down Expand Up @@ -276,8 +276,14 @@ export class Runtime implements IRuntime {
if (config.query) {
for (const key in config.query) {
const value = config.query[key];
if (value !== undefined) {
url.searchParams.append(key, value);
if (value !== undefined && value !== null) {
if (Object.prototype.toString.call(value) === '[object Object]') {
url.searchParams.append(key, JSON.stringify(value));
} else if (Array.isArray(value)) {
value.forEach(v => url.searchParams.append(key, v))
} else {
url.searchParams.append(key, value);
}
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions __test__/3.0/link-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class Runtime implements IRuntime {
// @ts-ignore ignore error
this[method] = (url: string, config?: IRuntimeRequestCommonOptions = {}) => {
return this.request({
method: method.toUpperCase(),
method: method.toUpperCase() as Uppercase<string>,
url,
...config,
});
Expand Down Expand Up @@ -297,8 +297,14 @@ export class Runtime implements IRuntime {
if (config.query) {
for (const key in config.query) {
const value = config.query[key];
if (value !== undefined) {
url.searchParams.append(key, value);
if (value !== undefined && value !== null) {
if (Object.prototype.toString.call(value) === '[object Object]') {
url.searchParams.append(key, JSON.stringify(value));
} else if (Array.isArray(value)) {
value.forEach(v => url.searchParams.append(key, v))
} else {
url.searchParams.append(key, value);
}
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions __test__/3.0/petstore-expanded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export class Runtime implements IRuntime {
// @ts-ignore ignore error
this[method] = (url: string, config?: IRuntimeRequestCommonOptions = {}) => {
return this.request({
method: method.toUpperCase(),
method: method.toUpperCase() as Uppercase<string>,
url,
...config,
});
Expand Down Expand Up @@ -307,8 +307,14 @@ export class Runtime implements IRuntime {
if (config.query) {
for (const key in config.query) {
const value = config.query[key];
if (value !== undefined) {
url.searchParams.append(key, value);
if (value !== undefined && value !== null) {
if (Object.prototype.toString.call(value) === '[object Object]') {
url.searchParams.append(key, JSON.stringify(value));
} else if (Array.isArray(value)) {
value.forEach(v => url.searchParams.append(key, v))
} else {
url.searchParams.append(key, value);
}
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions __test__/3.0/uspto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export class Runtime implements IRuntime {
// @ts-ignore ignore error
this[method] = (url: string, config?: IRuntimeRequestCommonOptions = {}) => {
return this.request({
method: method.toUpperCase(),
method: method.toUpperCase() as Uppercase<string>,
url,
...config,
});
Expand Down Expand Up @@ -320,8 +320,14 @@ export class Runtime implements IRuntime {
if (config.query) {
for (const key in config.query) {
const value = config.query[key];
if (value !== undefined) {
url.searchParams.append(key, value);
if (value !== undefined && value !== null) {
if (Object.prototype.toString.call(value) === '[object Object]') {
url.searchParams.append(key, JSON.stringify(value));
} else if (Array.isArray(value)) {
value.forEach(v => url.searchParams.append(key, v))
} else {
url.searchParams.append(key, value);
}
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions __test__/3.1/webhook-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class Runtime implements IRuntime {
// @ts-ignore ignore error
this[method] = (url: string, config?: IRuntimeRequestCommonOptions = {}) => {
return this.request({
method: method.toUpperCase(),
method: method.toUpperCase() as Uppercase<string>,
url,
...config,
});
Expand Down Expand Up @@ -276,8 +276,14 @@ export class Runtime implements IRuntime {
if (config.query) {
for (const key in config.query) {
const value = config.query[key];
if (value !== undefined) {
url.searchParams.append(key, value);
if (value !== undefined && value !== null) {
if (Object.prototype.toString.call(value) === '[object Object]') {
url.searchParams.append(key, JSON.stringify(value));
} else if (Array.isArray(value)) {
value.forEach(v => url.searchParams.append(key, v))
} else {
url.searchParams.append(key, value);
}
}
}
}
Expand Down

0 comments on commit 9ddc3fc

Please sign in to comment.