forked from loafle/openapi-generator-original
[Typescript] Change btoa to native code (#14258)
* Change btoa to native code * update samples
This commit is contained in:
@@ -1,10 +1,3 @@
|
||||
{{#platforms}}
|
||||
{{#node}}
|
||||
// typings for btoa are incorrect
|
||||
//@ts-ignore
|
||||
import {{^supportsES6}}* as{{/supportsES6}} btoa from "btoa";
|
||||
{{/node}}
|
||||
{{/platforms}}
|
||||
import { RequestContext } from "../http/http{{extensionForDeno}}";
|
||||
{{#useInversify}}
|
||||
import { injectable, inject, named } from "inversify";
|
||||
@@ -92,8 +85,8 @@ export class {{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication
|
||||
context.{{#isKeyInHeader}}setHeaderParam{{/isKeyInHeader}}{{#isKeyInQuery}}setQueryParam{{/isKeyInQuery}}{{#isKeyInCookie}}addCookie{{/isKeyInCookie}}("{{keyParamName}}", this.apiKey);
|
||||
{{/isApiKey}}
|
||||
{{#isBasicBasic}}
|
||||
let comb = this.username + ":" + this.password;
|
||||
context.setHeaderParam("Authorization", "Basic " + btoa(comb));
|
||||
let comb = Buffer.from(this.username + ":" + this.password, 'binary').toString('base64');
|
||||
context.setHeaderParam("Authorization", "Basic " + comb);
|
||||
{{/isBasicBasic}}
|
||||
{{#isBasicBearer}}
|
||||
context.setHeaderParam("Authorization", "Bearer " + await this.tokenProvider.getToken());
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
{{#node}}
|
||||
"@types/node": "*",
|
||||
"form-data": "^2.5.0",
|
||||
"btoa": "^1.2.1",
|
||||
{{/node}}
|
||||
{{/platforms}}
|
||||
{{#useRxJS}}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// typings for btoa are incorrect
|
||||
//@ts-ignore
|
||||
import * as btoa from "btoa";
|
||||
import { RequestContext } from "../http/http";
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
"@types/node-fetch": "^2.5.7",
|
||||
"@types/node": "*",
|
||||
"form-data": "^2.5.0",
|
||||
"btoa": "^1.2.1",
|
||||
"es6-promise": "^4.2.4",
|
||||
"url-parse": "^1.4.3"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// typings for btoa are incorrect
|
||||
//@ts-ignore
|
||||
import * as btoa from "btoa";
|
||||
import { RequestContext } from "../http/http";
|
||||
import { injectable, inject, named } from "inversify";
|
||||
import { AbstractTokenProvider } from "../services/configuration";
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
"@types/node-fetch": "^2.5.7",
|
||||
"@types/node": "*",
|
||||
"form-data": "^2.5.0",
|
||||
"btoa": "^1.2.1",
|
||||
"inversify": "^5.0.1",
|
||||
"es6-promise": "^4.2.4",
|
||||
"url-parse": "^1.4.3"
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// typings for btoa are incorrect
|
||||
//@ts-ignore
|
||||
import * as btoa from "btoa";
|
||||
import { RequestContext } from "../http/http";
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
"@types/node-fetch": "^2.5.7",
|
||||
"@types/node": "*",
|
||||
"form-data": "^2.5.0",
|
||||
"btoa": "^1.2.1",
|
||||
"es6-promise": "^4.2.4",
|
||||
"url-parse": "^1.4.3"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user