forked from loafle/openapi-generator-original
fix typescript fetch compile issue (#2383)
* fix tyepscript fetch compile issue * generate samples * improve fix
This commit is contained in:
parent
302b2fafff
commit
ce60dbbc58
@ -189,12 +189,12 @@ export function querystring(params: HTTPQuery, prefix: string = '') {
|
|||||||
const fullKey = prefix + (prefix.length ? `[${key}]` : key);
|
const fullKey = prefix + (prefix.length ? `[${key}]` : key);
|
||||||
const value = params[key];
|
const value = params[key];
|
||||||
if (value instanceof Array) {
|
if (value instanceof Array) {
|
||||||
const multiValue = value.map(singleValue => encodeURIComponent(singleValue))
|
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
|
||||||
.join(`&${encodeURIComponent(fullKey)}=`);
|
.join(`&${encodeURIComponent(fullKey)}=`);
|
||||||
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
||||||
}
|
}
|
||||||
if (value instanceof Object) {
|
if (value instanceof Object) {
|
||||||
return querystring(value, fullKey);
|
return querystring(value as HTTPQuery, fullKey);
|
||||||
}
|
}
|
||||||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
||||||
})
|
})
|
||||||
|
@ -200,12 +200,12 @@ export function querystring(params: HTTPQuery, prefix: string = '') {
|
|||||||
const fullKey = prefix + (prefix.length ? `[${key}]` : key);
|
const fullKey = prefix + (prefix.length ? `[${key}]` : key);
|
||||||
const value = params[key];
|
const value = params[key];
|
||||||
if (value instanceof Array) {
|
if (value instanceof Array) {
|
||||||
const multiValue = value.map(singleValue => encodeURIComponent(singleValue))
|
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
|
||||||
.join(`&${encodeURIComponent(fullKey)}=`);
|
.join(`&${encodeURIComponent(fullKey)}=`);
|
||||||
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
||||||
}
|
}
|
||||||
if (value instanceof Object) {
|
if (value instanceof Object) {
|
||||||
return querystring(value, fullKey);
|
return querystring(value as HTTPQuery, fullKey);
|
||||||
}
|
}
|
||||||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
||||||
})
|
})
|
||||||
|
@ -200,12 +200,12 @@ export function querystring(params: HTTPQuery, prefix: string = '') {
|
|||||||
const fullKey = prefix + (prefix.length ? `[${key}]` : key);
|
const fullKey = prefix + (prefix.length ? `[${key}]` : key);
|
||||||
const value = params[key];
|
const value = params[key];
|
||||||
if (value instanceof Array) {
|
if (value instanceof Array) {
|
||||||
const multiValue = value.map(singleValue => encodeURIComponent(singleValue))
|
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
|
||||||
.join(`&${encodeURIComponent(fullKey)}=`);
|
.join(`&${encodeURIComponent(fullKey)}=`);
|
||||||
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
||||||
}
|
}
|
||||||
if (value instanceof Object) {
|
if (value instanceof Object) {
|
||||||
return querystring(value, fullKey);
|
return querystring(value as HTTPQuery, fullKey);
|
||||||
}
|
}
|
||||||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
||||||
})
|
})
|
||||||
|
@ -200,12 +200,12 @@ export function querystring(params: HTTPQuery, prefix: string = '') {
|
|||||||
const fullKey = prefix + (prefix.length ? `[${key}]` : key);
|
const fullKey = prefix + (prefix.length ? `[${key}]` : key);
|
||||||
const value = params[key];
|
const value = params[key];
|
||||||
if (value instanceof Array) {
|
if (value instanceof Array) {
|
||||||
const multiValue = value.map(singleValue => encodeURIComponent(singleValue))
|
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
|
||||||
.join(`&${encodeURIComponent(fullKey)}=`);
|
.join(`&${encodeURIComponent(fullKey)}=`);
|
||||||
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
||||||
}
|
}
|
||||||
if (value instanceof Object) {
|
if (value instanceof Object) {
|
||||||
return querystring(value, fullKey);
|
return querystring(value as HTTPQuery, fullKey);
|
||||||
}
|
}
|
||||||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
||||||
})
|
})
|
||||||
|
@ -200,12 +200,12 @@ export function querystring(params: HTTPQuery, prefix: string = '') {
|
|||||||
const fullKey = prefix + (prefix.length ? `[${key}]` : key);
|
const fullKey = prefix + (prefix.length ? `[${key}]` : key);
|
||||||
const value = params[key];
|
const value = params[key];
|
||||||
if (value instanceof Array) {
|
if (value instanceof Array) {
|
||||||
const multiValue = value.map(singleValue => encodeURIComponent(singleValue))
|
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
|
||||||
.join(`&${encodeURIComponent(fullKey)}=`);
|
.join(`&${encodeURIComponent(fullKey)}=`);
|
||||||
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
||||||
}
|
}
|
||||||
if (value instanceof Object) {
|
if (value instanceof Object) {
|
||||||
return querystring(value, fullKey);
|
return querystring(value as HTTPQuery, fullKey);
|
||||||
}
|
}
|
||||||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user