Skip to content

Commit a9970e4

Browse files
committed
Added security check for operations
1 parent 3213366 commit a9970e4

File tree

5 files changed

+6
-9
lines changed

5 files changed

+6
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openapi-typescript-codegen",
3-
"version": "0.26.2",
3+
"version": "0.26.3",
44
"description": "Library that generates Typescript clients based on the OpenAPI specification.",
55
"author": "Ferdi Koomen",
66
"homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen",

src/templates/core/angular/getHeaders.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const getHeaders = (config: OpenAPIConfig, options: ApiRequestOptions): Observable<HttpHeaders> => {
2+
const token = options.secured ? await resolve(options, config.TOKEN) : undefined;
23
return forkJoin({
3-
token: resolve(options, config.TOKEN),
4+
token,
45
username: resolve(options, config.USERNAME),
56
password: resolve(options, config.PASSWORD),
67
additionalHeaders: resolve(options, config.HEADERS),

src/templates/core/axios/getHeaders.hbs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise<Record<string, string>> => {
2-
if (options.secured) {
3-
const token = await resolve(options, config.TOKEN);
4-
}
2+
const token = options.secured ? await resolve(options, config.TOKEN) : undefined;
53
const username = await resolve(options, config.USERNAME);
64
const password = await resolve(options, config.PASSWORD);
75
const additionalHeaders = await resolve(options, config.HEADERS);

src/templates/core/fetch/getHeaders.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise<Headers> => {
2-
const token = await resolve(options, config.TOKEN);
2+
const token = options.secured ? await resolve(options, config.TOKEN) : undefined;
33
const username = await resolve(options, config.USERNAME);
44
const password = await resolve(options, config.PASSWORD);
55
const additionalHeaders = await resolve(options, config.HEADERS);

src/templates/core/xhr/getHeaders.hbs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise<Headers> => {
2-
if (options.secured) {
3-
const token = await resolve(options, config.TOKEN);
4-
}
2+
const token = options.secured ? await resolve(options, config.TOKEN) : undefined;
53
const username = await resolve(options, config.USERNAME);
64
const password = await resolve(options, config.PASSWORD);
75
const additionalHeaders = await resolve(options, config.HEADERS);

0 commit comments

Comments
 (0)