diff --git a/__test__/3.0/LDFCore.ts b/__test__/3.0/LDFCore.ts index f6384b6..f139f33 100644 --- a/__test__/3.0/LDFCore.ts +++ b/__test__/3.0/LDFCore.ts @@ -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, url, ...config, }); @@ -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); + } } } } diff --git a/__test__/3.0/Petstore.ts b/__test__/3.0/Petstore.ts index abae137..466738f 100644 --- a/__test__/3.0/Petstore.ts +++ b/__test__/3.0/Petstore.ts @@ -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, url, ...config, }); @@ -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); + } } } } diff --git a/__test__/3.0/api-auth.ts b/__test__/3.0/api-auth.ts index 01b2ee6..c364c59 100644 --- a/__test__/3.0/api-auth.ts +++ b/__test__/3.0/api-auth.ts @@ -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, url, ...config, }); @@ -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); + } } } } diff --git a/__test__/3.0/api-upms.ts b/__test__/3.0/api-upms.ts index b3835e5..099e1c3 100644 --- a/__test__/3.0/api-upms.ts +++ b/__test__/3.0/api-upms.ts @@ -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, url, ...config, }); @@ -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); + } } } } diff --git a/__test__/3.0/api-with-examples.ts b/__test__/3.0/api-with-examples.ts index e4d8156..390462d 100644 --- a/__test__/3.0/api-with-examples.ts +++ b/__test__/3.0/api-with-examples.ts @@ -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, url, ...config, }); @@ -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); + } } } } diff --git a/__test__/3.0/callback-example.ts b/__test__/3.0/callback-example.ts index 07ddd84..5a710be 100644 --- a/__test__/3.0/callback-example.ts +++ b/__test__/3.0/callback-example.ts @@ -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, url, ...config, }); @@ -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); + } } } } diff --git a/__test__/3.0/link-example.ts b/__test__/3.0/link-example.ts index 554d79d..a108c86 100644 --- a/__test__/3.0/link-example.ts +++ b/__test__/3.0/link-example.ts @@ -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, url, ...config, }); @@ -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); + } } } } diff --git a/__test__/3.0/petstore-expanded.ts b/__test__/3.0/petstore-expanded.ts index 7efdb5d..fa39de8 100644 --- a/__test__/3.0/petstore-expanded.ts +++ b/__test__/3.0/petstore-expanded.ts @@ -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, url, ...config, }); @@ -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); + } } } } diff --git a/__test__/3.0/uspto.ts b/__test__/3.0/uspto.ts index 7e189b7..e3c8caf 100644 --- a/__test__/3.0/uspto.ts +++ b/__test__/3.0/uspto.ts @@ -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, url, ...config, }); @@ -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); + } } } } diff --git a/__test__/3.1/webhook-example.ts b/__test__/3.1/webhook-example.ts index a844ad5..6d1706a 100644 --- a/__test__/3.1/webhook-example.ts +++ b/__test__/3.1/webhook-example.ts @@ -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, url, ...config, }); @@ -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); + } } } }