@gatling.io/http 3.14.0 → 3.14.100

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gatling.io/http",
3
- "version": "3.14.0",
3
+ "version": "3.14.100",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://gatling.io",
6
6
  "repository": "github:gatling/gatling-js",
@@ -20,8 +20,8 @@
20
20
  "main": "target/index.js",
21
21
  "types": "target/index.d.ts",
22
22
  "dependencies": {
23
- "@gatling.io/jvm-types": "3.14.0",
24
- "@gatling.io/core": "3.14.0"
23
+ "@gatling.io/jvm-types": "3.14.100",
24
+ "@gatling.io/core": "3.14.100"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/jest": "29.5.14",
package/target/proxy.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Wrapper } from "@gatling.io/core";
1
+ import { Session, Wrapper } from "@gatling.io/core";
2
2
  import JvmProxy = io.gatling.javaapi.http.Proxy;
3
3
  export interface Proxy extends Wrapper<JvmProxy> {
4
4
  /**
@@ -26,13 +26,61 @@ export interface Proxy extends Wrapper<JvmProxy> {
26
26
  */
27
27
  socks5(): Proxy;
28
28
  /**
29
- * Define some Basic Auth credentials for this proxy
29
+ * Define some username-password credentials for this proxy
30
30
  *
31
- * @param username - the username
32
- * @param password - the password
33
- * @returns a new Proxy instance
31
+ * @param username the username, expressed as a Gatling Expression Language String
32
+ * @param password the password, expressed as a Gatling Expression Language String
33
+ * @return a new Proxy instance
34
34
  */
35
35
  credentials(username: string, password: string): Proxy;
36
+ /**
37
+ * Define some username-password credentials for this proxy
38
+ *
39
+ * @param username the username, expressed as a Gatling Expression Language String
40
+ * @param password the password, expressed as a function
41
+ * @return a new Proxy instance
42
+ */
43
+ credentials(username: string, password: (session: Session) => string): Proxy;
44
+ /**
45
+ * Define some username-password credentials for this proxy
46
+ *
47
+ * @param username the username, expressed as a function
48
+ * @param password the password, expressed as a Gatling Expression Language String
49
+ * @return a new Proxy instance
50
+ */
51
+ credentials(username: (session: Session) => string, password: string): Proxy;
52
+ /**
53
+ * Define some username-password credentials for this proxy
54
+ *
55
+ * @param username the username, expressed as a function
56
+ * @param password the password, expressed as a function
57
+ * @return a new Proxy instance
58
+ */
59
+ credentials(username: (session: Session) => string, password: (session: Session) => string): Proxy;
60
+ /**
61
+ * Set a header for the CONNECT request (HTTP(S) proxies only)
62
+ *
63
+ * @param name the static header name
64
+ * @param value the header value, expressed as a Gatling Expression Language String
65
+ * @return a new Proxy instance
66
+ */
67
+ connectHeader(name: string, value: string): Proxy;
68
+ /**
69
+ * Set a header for the CONNECT request (HTTP(S) proxies only)
70
+ *
71
+ * @param name the static header name
72
+ * @param value the header value, expressed as a function
73
+ * @return a new Proxy instance
74
+ */
75
+ connectHeader(name: string, value: (session: Session) => string): Proxy;
76
+ /**
77
+ * Set a header for the CONNECT request (HTTP(S) proxies only)
78
+ *
79
+ * @param headers the headers, names are static but values are expressed as a Gatling Expression
80
+ * Language String
81
+ * @return a new Proxy instance
82
+ */
83
+ connectHeaders(headers: Record<string, string>): Proxy;
36
84
  }
37
85
  /**
38
86
  * Bootstrap the DSL for defining a Proxy
package/target/proxy.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Proxy = void 0;
4
+ const core_1 = require("@gatling.io/core");
4
5
  const jvm_types_1 = require("@gatling.io/jvm-types");
5
6
  const wrapProxy = (_underlying) => ({
6
7
  _underlying,
@@ -8,7 +9,17 @@ const wrapProxy = (_underlying) => ({
8
9
  https: () => wrapProxy(_underlying.https()),
9
10
  socks4: () => wrapProxy(_underlying.socks4()),
10
11
  socks5: () => wrapProxy(_underlying.socks5()),
11
- credentials: (username, password) => wrapProxy(_underlying.credentials(username, password))
12
+ credentials: (username, password) => wrapProxy(typeof username === "function"
13
+ ? typeof password === "function"
14
+ ? _underlying.credentials((0, core_1.underlyingSessionTo)(username), (0, core_1.underlyingSessionTo)(password))
15
+ : _underlying.credentials((0, core_1.underlyingSessionTo)(username), password)
16
+ : typeof password === "function"
17
+ ? _underlying.credentials(username, (0, core_1.underlyingSessionTo)(password))
18
+ : _underlying.credentials(username, password)),
19
+ connectHeader: (name, value) => wrapProxy(typeof value === "function"
20
+ ? _underlying.connectHeader(name, (0, core_1.underlyingSessionTo)(value))
21
+ : _underlying.connectHeader(name, value)),
22
+ connectHeaders: (headers) => wrapProxy(_underlying.connectHeaders((0, core_1.asJava)(headers)))
12
23
  });
13
24
  /**
14
25
  * Bootstrap the DSL for defining a Proxy