forked from loafle/openapi-generator-original
make typescript-fetch code compatiable with nodejs environment (#10072)
This commit is contained in:
parent
75181210d5
commit
c05ec99182
@ -74,7 +74,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -137,7 +137,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
@ -85,7 +85,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -148,7 +148,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
@ -85,7 +85,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -148,7 +148,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
@ -85,7 +85,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -148,7 +148,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
@ -85,7 +85,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -148,7 +148,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
@ -85,7 +85,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -148,7 +148,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
@ -85,7 +85,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -148,7 +148,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
@ -85,7 +85,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -148,7 +148,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
@ -85,7 +85,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -148,7 +148,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
@ -85,7 +85,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -148,7 +148,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
@ -85,7 +85,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -148,7 +148,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
@ -85,7 +85,7 @@ export class BaseAPI {
|
|||||||
}) || fetchParams;
|
}) || fetchParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
|
let response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
||||||
for (const middleware of this.middleware) {
|
for (const middleware of this.middleware) {
|
||||||
if (middleware.post) {
|
if (middleware.post) {
|
||||||
response = await middleware.post({
|
response = await middleware.post({
|
||||||
@ -148,7 +148,7 @@ export class Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fetchApi(): FetchAPI {
|
get fetchApi(): FetchAPI {
|
||||||
return this.configuration.fetchApi || window.fetch.bind(window);
|
return this.configuration.fetchApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
get middleware(): Middleware[] {
|
get middleware(): Middleware[] {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user