transit-core-taf 1.0.16 → 1.0.17

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.
@@ -10,6 +10,7 @@ export declare class TestRailClient {
10
10
  private user;
11
11
  private projectId;
12
12
  private auth;
13
+ private httpsAgent;
13
14
  constructor(options: TestRailClientOptions);
14
15
  private apiPost;
15
16
  createTestRun(suiteId: number, name: string, description: string): Promise<any>;
@@ -17,6 +17,7 @@ class TestRailClient {
17
17
  user;
18
18
  projectId;
19
19
  auth;
20
+ httpsAgent;
20
21
  constructor(options) {
21
22
  const { host, user, projectId, token, password } = options;
22
23
  if (!host || !user || !projectId || !(token || password)) {
@@ -25,21 +26,21 @@ class TestRailClient {
25
26
  this.host = host;
26
27
  this.user = user;
27
28
  this.projectId = projectId;
29
+ this.httpsAgent = new https_1.default.Agent({
30
+ rejectUnauthorized: false,
31
+ });
28
32
  const credentials = token ?? password;
29
33
  this.auth = `Basic ${Buffer.from(`${this.user}:${credentials}`).toString('base64')}`;
30
34
  }
31
35
  async apiPost(endpoint, data) {
32
36
  const url = `${this.host}index.php?/api/v2/${endpoint}`;
33
- const httpsAgent = new https_1.default.Agent({
34
- rejectUnauthorized: false,
35
- });
36
37
  try {
37
38
  const response = await axios_1.default.post(url, data, {
38
39
  headers: {
39
40
  'Content-Type': 'application/json',
40
41
  Authorization: this.auth,
41
42
  },
42
- httpsAgent,
43
+ httpsAgent: this.httpsAgent,
43
44
  });
44
45
  return response.data;
45
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "transit-core-taf",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Transit Core Automation Framework",
5
5
  "main": "dist/transit-core-taf/index.js",
6
6
  "types": "dist/transit-core-taf/index.d.ts",