lhisp-oauth-client 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -90,18 +90,6 @@ describe("Get Access Token", () => {
90
90
  data: `{"grant_type":"${defaultGrantValue}","client_id":"${clientId}","client_secret":"${clientSecret}"}`,
91
91
  }));
92
92
  }));
93
- it("Shoud Get with Credentials without ContentType", () => __awaiter(void 0, void 0, void 0, function* () {
94
- const cli = getOauthClient(Object.assign(Object.assign({}, baseClientParams), { disableAuthContentType: true }));
95
- yield accessTokenValidator(cli);
96
- expect(mockedAxios.request).toBeCalledWith(expect.objectContaining({
97
- url: authUrl,
98
- method: "POST",
99
- headers: {
100
- Authorization: basicAuth,
101
- },
102
- data: `grant_type=${defaultGrantValue}`,
103
- }));
104
- }));
105
93
  });
106
94
  describe("Request", () => {
107
95
  beforeEach(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lhisp-oauth-client",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "main": "src/index",
5
5
  "types": "src/index.d.ts",
6
6
  "repository": "git@bitbucket.org:leandro_costa/lhisp-oauth-client.git",
@@ -9,7 +9,6 @@ export declare class LhispOauthClient<iAccessToken extends AccessToken = AccessT
9
9
  protected authHeaderName: string;
10
10
  protected tokenHeaderName: string;
11
11
  protected authContentType: ContentType;
12
- protected disableAuthContentType: boolean;
13
12
  protected certificado?: string;
14
13
  protected senhaCertificado?: string;
15
14
  protected authScope?: string;
@@ -20,7 +20,6 @@ const lhisp_oauth_client_t_1 = require("./lhisp-oauth-client.t");
20
20
  const lhisp_logger_1 = __importDefault(require("lhisp-logger"));
21
21
  class LhispOauthClient {
22
22
  constructor(params) {
23
- this.disableAuthContentType = false;
24
23
  this.tokenCreatedAt = 0;
25
24
  this.tokenExpiresIn = 0;
26
25
  if (params.certificado) {
@@ -42,7 +41,6 @@ class LhispOauthClient {
42
41
  this.authScope = params.authScope;
43
42
  this.grantType = params.grantType || lhisp_oauth_client_t_1.defaultGrantType;
44
43
  this.authContentType = params.authContentType || lhisp_oauth_client_t_1.defaultAuthContentType;
45
- this.disableAuthContentType = Boolean(params.disableAuthContentType);
46
44
  this.clientId = params.clientId;
47
45
  this.clientSecret = params.clientSecret;
48
46
  this.authHeaderName = params.authHeaderName || lhisp_oauth_client_t_1.defaultAuthHeaderName;
@@ -84,7 +82,10 @@ class LhispOauthClient {
84
82
  method: "POST",
85
83
  url: this.authUrl,
86
84
  httpsAgent: this.agent,
87
- headers: Object.assign({ [this.authHeaderName]: this.getAuthHeaderValue() }, (this.disableAuthContentType ? {} : { "Content-Type": this.authContentType })),
85
+ headers: {
86
+ [this.authHeaderName]: this.getAuthHeaderValue(),
87
+ "Content-Type": this.authContentType,
88
+ },
88
89
  data: {},
89
90
  };
90
91
  if (this.grantType)
@@ -97,7 +98,10 @@ class LhispOauthClient {
97
98
  if (this.clientSecret)
98
99
  authRequestOpt.data.client_secret = this.clientSecret;
99
100
  }
100
- authRequestOpt.data = this.parseData({ data: authRequestOpt.data, contentType: this.authContentType });
101
+ authRequestOpt.data = this.parseData({
102
+ data: authRequestOpt.data,
103
+ contentType: this.authContentType,
104
+ });
101
105
  const resp = yield axios_1.default.request(authRequestOpt);
102
106
  this.accessToken = this.buildAccessToken(resp.data);
103
107
  this.tokenCreatedAt = new Date().getTime();
@@ -16,7 +16,6 @@ export interface LhispOauthClientConstructorParams {
16
16
  grantType?: string;
17
17
  authContentType?: ContentType;
18
18
  sendAuthCredentialsOnRequestBody?: boolean;
19
- disableAuthContentType?: boolean;
20
19
  debug?: boolean;
21
20
  }
22
21
  export interface ExecutarRequestParams extends AxiosRequestConfig {