@ekhein/http-request 1.0.7 → 1.0.8

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/dist/main.d.ts CHANGED
@@ -1,11 +1,13 @@
1
- import { AxiosInstance } from "axios";
1
+ import { AxiosHeaders, AxiosInstance } from "axios";
2
2
  import { HttpRequestConfig } from "../types/http-request";
3
+ export declare class HttpRequestHeaders extends AxiosHeaders {
4
+ }
3
5
  export declare class HttpRequest {
4
6
  readonly instance: AxiosInstance;
5
7
  constructor(options: HttpRequestConfig);
6
8
  execute<R = any>(options: HttpRequestConfig): Promise<R>;
7
- post<R = any>(url: string, data?: any): Promise<R>;
8
- call<R = any>(path: string, data: object): Promise<R>;
9
+ post<R = any>(url: string, data?: any, opts?: HttpRequestConfig): Promise<R>;
10
+ call<R = any>(path: string, data: object, opts?: HttpRequestConfig): Promise<R>;
9
11
  }
10
12
  export * from './libs';
11
13
  export * from './exceptions';
package/dist/main.js CHANGED
@@ -45,7 +45,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
45
45
  });
46
46
  };
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.HttpRequest = void 0;
48
+ exports.HttpRequest = exports.HttpRequestHeaders = void 0;
49
49
  const axios_1 = __importStar(require("axios"));
50
50
  const jsdom_1 = require("jsdom");
51
51
  const lodash_1 = require("lodash");
@@ -59,6 +59,9 @@ const agent_1 = require("./agent");
59
59
  const agent_2 = require("./agent");
60
60
  const agent_3 = require("./agent");
61
61
  const exceptions_1 = require("./exceptions");
62
+ class HttpRequestHeaders extends axios_1.AxiosHeaders {
63
+ }
64
+ exports.HttpRequestHeaders = HttpRequestHeaders;
62
65
  class HttpRequest {
63
66
  constructor(options) {
64
67
  var _a, _b, _c, _d;
@@ -227,16 +230,16 @@ class HttpRequest {
227
230
  .request(options);
228
231
  });
229
232
  }
230
- post(url, data) {
233
+ post(url, data, opts) {
231
234
  return __awaiter(this, void 0, void 0, function* () {
232
235
  return this.instance
233
- .request({ method: "POST", serviceType: 1, url, data });
236
+ .request(Object.assign(Object.assign({}, opts), { method: "POST", serviceType: 1, url, data }));
234
237
  });
235
238
  }
236
- call(path, data) {
239
+ call(path, data, opts) {
237
240
  return __awaiter(this, void 0, void 0, function* () {
238
241
  return this.instance
239
- .request({ method: "POST", serviceType: 2, path, data });
242
+ .request(Object.assign(Object.assign({}, opts), { method: "POST", serviceType: 2, path, data }));
240
243
  });
241
244
  }
242
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekhein/http-request",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "license": "MIT",
5
5
  "author": "ekhein",
6
6
  "main": "./dist/main.js",