lhisp-oauth-client 1.0.33 → 1.0.35
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.
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@ export declare class LhispOauthClient<iAccessToken extends AccessToken = AccessT
|
|
|
34
34
|
getAccessToken(): Promise<iAccessToken>;
|
|
35
35
|
buildAccessToken(data: any): iAccessToken;
|
|
36
36
|
getAuthToken(): string;
|
|
37
|
-
executarRequest<ResponseType>({ method, path, data, params, contentType, ...opt }: ExecutarRequestParams): Promise<ResponseType>;
|
|
37
|
+
executarRequest<ResponseType>({ method, path, data, params, contentType, headers: paramsHeaders, ...opt }: ExecutarRequestParams): Promise<ResponseType>;
|
|
38
38
|
get<ResponseType>(opt: ExecutarRequestParams): Promise<ResponseType>;
|
|
39
39
|
put<ResponseType>(opt: ExecutarRequestParams): Promise<ResponseType>;
|
|
40
40
|
patch<ResponseType>(opt: ExecutarRequestParams): Promise<ResponseType>;
|
|
@@ -147,13 +147,13 @@ class LhispOauthClient {
|
|
|
147
147
|
}
|
|
148
148
|
executarRequest(_a) {
|
|
149
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
var { method, path, data, params, contentType = lhisp_oauth_client_t_1.ContentType.APPLICATION_JSON } = _a, opt = __rest(_a, ["method", "path", "data", "params", "contentType"]);
|
|
150
|
+
var { method, path, data, params, contentType = lhisp_oauth_client_t_1.ContentType.APPLICATION_JSON, headers: paramsHeaders } = _a, opt = __rest(_a, ["method", "path", "data", "params", "contentType", "headers"]);
|
|
151
151
|
try {
|
|
152
152
|
yield this.getAccessToken();
|
|
153
|
-
const headers = Object.assign({ "Content-Type": contentType, [this.tokenHeaderName]: this.getAuthToken() }, (this.headers || {}));
|
|
154
|
-
const response = yield axios_1.default.request(Object.assign({ method, url: `${this.apiUrl}${path}`, httpsAgent: this.agent, headers,
|
|
153
|
+
const headers = Object.assign(Object.assign({ "Content-Type": contentType, [this.tokenHeaderName]: this.getAuthToken() }, (this.headers || {})), (paramsHeaders || {}));
|
|
154
|
+
const response = yield axios_1.default.request(Object.assign(Object.assign({}, opt), { method, url: `${this.apiUrl}${path}`, httpsAgent: this.agent, headers,
|
|
155
155
|
data,
|
|
156
|
-
params, timeout: this.timeout }
|
|
156
|
+
params, timeout: this.timeout }));
|
|
157
157
|
return response.data;
|
|
158
158
|
}
|
|
159
159
|
catch (error) {
|