forked from loafle/openapi-generator-original
[typescript-fetch] runtime: pass init and url as returned by the premiddleware to the postmiddleware (#9716)
* pass init and url as returned by the premiddleware to the postmiddleware Current implementation will always pass the initial url and init object. However if a pre middleware changes returns an object whose `init` or `url` property refer to a different url string or object, any following post middleware wont have access to it. Effectively providing the post middleware with a completely different request information then what was actually used to make the fetch call. * update samples and docs
This commit is contained in:
parent
46f8a6733a
commit
32c1e925dc
@ -79,8 +79,8 @@ export class BaseAPI {
|
||||
if (middleware.post) {
|
||||
response = await middleware.post({
|
||||
fetch: this.fetchApi,
|
||||
url,
|
||||
init,
|
||||
url: fetchParams.url,
|
||||
init: fetchParams.init,
|
||||
response: response.clone(),
|
||||
}) || response;
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ export class BaseAPI {
|
||||
if (middleware.post) {
|
||||
response = await middleware.post({
|
||||
fetch: this.fetchApi,
|
||||
url,
|
||||
init,
|
||||
url: fetchParams.url,
|
||||
init: fetchParams.init,
|
||||
response: response.clone(),
|
||||
}) || response;
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ export class BaseAPI {
|
||||
if (middleware.post) {
|
||||
response = await middleware.post({
|
||||
fetch: this.fetchApi,
|
||||
url,
|
||||
init,
|
||||
url: fetchParams.url,
|
||||
init: fetchParams.init,
|
||||
response: response.clone(),
|
||||
}) || response;
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ export class BaseAPI {
|
||||
if (middleware.post) {
|
||||
response = await middleware.post({
|
||||
fetch: this.fetchApi,
|
||||
url,
|
||||
init,
|
||||
url: fetchParams.url,
|
||||
init: fetchParams.init,
|
||||
response: response.clone(),
|
||||
}) || response;
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ export class BaseAPI {
|
||||
if (middleware.post) {
|
||||
response = await middleware.post({
|
||||
fetch: this.fetchApi,
|
||||
url,
|
||||
init,
|
||||
url: fetchParams.url,
|
||||
init: fetchParams.init,
|
||||
response: response.clone(),
|
||||
}) || response;
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ export class BaseAPI {
|
||||
if (middleware.post) {
|
||||
response = await middleware.post({
|
||||
fetch: this.fetchApi,
|
||||
url,
|
||||
init,
|
||||
url: fetchParams.url,
|
||||
init: fetchParams.init,
|
||||
response: response.clone(),
|
||||
}) || response;
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ export class BaseAPI {
|
||||
if (middleware.post) {
|
||||
response = await middleware.post({
|
||||
fetch: this.fetchApi,
|
||||
url,
|
||||
init,
|
||||
url: fetchParams.url,
|
||||
init: fetchParams.init,
|
||||
response: response.clone(),
|
||||
}) || response;
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ export class BaseAPI {
|
||||
if (middleware.post) {
|
||||
response = await middleware.post({
|
||||
fetch: this.fetchApi,
|
||||
url,
|
||||
init,
|
||||
url: fetchParams.url,
|
||||
init: fetchParams.init,
|
||||
response: response.clone(),
|
||||
}) || response;
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ export class BaseAPI {
|
||||
if (middleware.post) {
|
||||
response = await middleware.post({
|
||||
fetch: this.fetchApi,
|
||||
url,
|
||||
init,
|
||||
url: fetchParams.url,
|
||||
init: fetchParams.init,
|
||||
response: response.clone(),
|
||||
}) || response;
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ export class BaseAPI {
|
||||
if (middleware.post) {
|
||||
response = await middleware.post({
|
||||
fetch: this.fetchApi,
|
||||
url,
|
||||
init,
|
||||
url: fetchParams.url,
|
||||
init: fetchParams.init,
|
||||
response: response.clone(),
|
||||
}) || response;
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ export class BaseAPI {
|
||||
if (middleware.post) {
|
||||
response = await middleware.post({
|
||||
fetch: this.fetchApi,
|
||||
url,
|
||||
init,
|
||||
url: fetchParams.url,
|
||||
init: fetchParams.init,
|
||||
response: response.clone(),
|
||||
}) || response;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user