Closed
Description
Hi! Thanks for the great package.
This seems to be a Fetch API variation of another issue - #192.
Here is what the request
method looks like after generating the API with the following parameters:
$ yarn swagger-typescript-api -p ./source.json -o . -n result.ts
class Api {
// ...
public request = async <T = any, E = any>({
body,
secure,
// ...
...params
}: FullRequestParams): Promise<HttpResponse<T, E>> => {
// the "secure" option from this.baseApiParams is not used here
const secureParams =
(secure &&
this.securityWorker &&
(await this.securityWorker(this.securityData))) ||
{};
const requestParams = this.mergeRequestParams(params, secureParams);
// ...
};
}
So, basically, when the Fetch API is used, there is no way to make use of securityWorker
other than specifying secure
on each request. With axios
this is solved trivially with interceptors, but I'd like to continue using the Fetch API.
Here is a simple reproduction of the issue (v7.0.0, just run $ yarn
): https://github.com/dkamyshov/swagger-typescript-api-bug-repro
swagger-typescript-api | 6.4.2, 7.0.0 |
---|
Metadata
Metadata
Assignees
Labels
No labels