@gatling.io/http 3.12.0 → 3.13.2

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,21 +1,21 @@
1
1
  {
2
2
  "name": "@gatling.io/http",
3
- "version": "3.12.0",
3
+ "version": "3.13.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "target/index.js",
6
6
  "types": "target/index.d.ts",
7
7
  "dependencies": {
8
- "@gatling.io/jvm-types": "3.12.0",
9
- "@gatling.io/core": "3.12.0"
8
+ "@gatling.io/jvm-types": "3.13.2",
9
+ "@gatling.io/core": "3.13.2"
10
10
  },
11
11
  "devDependencies": {
12
- "@types/jest": "29.5.12",
12
+ "@types/jest": "29.5.14",
13
13
  "jest": "29.7.0",
14
14
  "prettier": "3.3.3",
15
15
  "rimraf": "6.0.1",
16
16
  "ts-jest": "29.2.5",
17
17
  "ts-node": "10.9.2",
18
- "typescript": "5.5.4"
18
+ "typescript": "5.6.3"
19
19
  },
20
20
  "scripts": {
21
21
  "clean": "rimraf target",
package/src/protocol.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  import {
2
+ AllowListFilter,
2
3
  CheckBuilder,
3
4
  Condition,
5
+ DenyListFilter,
4
6
  Expression,
5
7
  ProtocolBuilder,
6
8
  Session,
7
9
  SessionTo,
10
+ asJava,
8
11
  underlyingSessionTo,
9
- wrapCondition,
10
- AllowListFilter,
11
- DenyListFilter
12
+ wrapCondition
12
13
  } from "@gatling.io/core";
13
14
 
14
15
  import { Proxy } from "./proxy";
@@ -700,6 +701,14 @@ export interface HttpProtocolBuilder extends ProtocolBuilder {
700
701
 
701
702
  // Proxy part
702
703
 
704
+ /**
705
+ * Define a Proxy to be used for all requests
706
+ *
707
+ * @param proxy - the proxy
708
+ * @returns a new HttpProtocolBuilder instance
709
+ */
710
+ proxy(proxy: Proxy): HttpProtocolBuilder;
711
+
703
712
  /**
704
713
  * Ignore any configured proxy for some hosts
705
714
  *
@@ -709,12 +718,36 @@ export interface HttpProtocolBuilder extends ProtocolBuilder {
709
718
  noProxyFor(...hosts: string[]): HttpProtocolBuilder;
710
719
 
711
720
  /**
712
- * Define a Proxy to be used for all requests
721
+ * Enable Proxy Protocol for IPv4
713
722
  *
714
- * @param proxy - the proxy
723
+ * @param address - a fake local address in IPv4 format
715
724
  * @returns a new HttpProtocolBuilder instance
716
725
  */
717
- proxy(proxy: Proxy): HttpProtocolBuilder;
726
+ proxyProtocolSourceIpV4Address(address: string): HttpProtocolBuilder;
727
+
728
+ /**
729
+ * Enable Proxy Protocol for IPv4
730
+ *
731
+ * @param address - a fake local address in IPv4 format
732
+ * @returns a new HttpProtocolBuilder instance
733
+ */
734
+ proxyProtocolSourceIpV4Address(address: (session: Session) => string): HttpProtocolBuilder;
735
+
736
+ /**
737
+ * Enable Proxy Protocol for IPv6
738
+ *
739
+ * @param address - a fake local address in IPv6 format
740
+ * @returns a new HttpProtocolBuilder instance
741
+ */
742
+ proxyProtocolSourceIpV6Address(address: string): HttpProtocolBuilder;
743
+
744
+ /**
745
+ * Enable Proxy Protocol for IPv6
746
+ *
747
+ * @param address - a fake local address in IPv6 format
748
+ * @returns a new HttpProtocolBuilder instance
749
+ */
750
+ proxyProtocolSourceIpV6Address(address: (session: Session) => string): HttpProtocolBuilder;
718
751
 
719
752
  // DNS part
720
753
 
@@ -776,7 +809,7 @@ export const wrapHttpProtocolBuilder = (_underlying: JvmHttpProtocolBuilder): Ht
776
809
  : _underlying.header(name, value)
777
810
  ),
778
811
  headers: (headers: Record<string, string>): HttpProtocolBuilder =>
779
- wrapHttpProtocolBuilder(_underlying.headers(headers)),
812
+ wrapHttpProtocolBuilder(_underlying.headers(asJava(headers) as any)),
780
813
  acceptHeader: (value: Expression<string>): HttpProtocolBuilder =>
781
814
  wrapHttpProtocolBuilder(
782
815
  typeof value === "function"
@@ -954,8 +987,20 @@ export const wrapHttpProtocolBuilder = (_underlying: JvmHttpProtocolBuilder): Ht
954
987
 
955
988
  // Proxy part
956
989
 
957
- noProxyFor: (...hosts: string[]): HttpProtocolBuilder => wrapHttpProtocolBuilder(_underlying.noProxyFor(...hosts)),
958
990
  proxy: (proxy: Proxy): HttpProtocolBuilder => wrapHttpProtocolBuilder(_underlying.proxy(proxy._underlying)),
991
+ noProxyFor: (...hosts: string[]): HttpProtocolBuilder => wrapHttpProtocolBuilder(_underlying.noProxyFor(...hosts)),
992
+ proxyProtocolSourceIpV4Address: (address: Expression<string>) =>
993
+ wrapHttpProtocolBuilder(
994
+ typeof address === "string"
995
+ ? _underlying.proxyProtocolSourceIpV4Address(address)
996
+ : _underlying.proxyProtocolSourceIpV4Address(underlyingSessionTo(address))
997
+ ),
998
+ proxyProtocolSourceIpV6Address: (address: Expression<string>) =>
999
+ wrapHttpProtocolBuilder(
1000
+ typeof address === "string"
1001
+ ? _underlying.proxyProtocolSourceIpV6Address(address)
1002
+ : _underlying.proxyProtocolSourceIpV6Address(underlyingSessionTo(address))
1003
+ ),
959
1004
 
960
1005
  // DNS part
961
1006
 
@@ -7,6 +7,7 @@ import {
7
7
  Expression,
8
8
  Session,
9
9
  SessionTo,
10
+ asJava,
10
11
  toJvmDuration,
11
12
  underlyingSessionTo,
12
13
  underlyingSessionToJava,
@@ -369,7 +370,7 @@ const requestWithParamsActionBuilderImpl = <T>(
369
370
  wrap(
370
371
  typeof value === "function" ? jvmBuilder.header(name, underlyingSessionTo(value)) : jvmBuilder.header(name, value)
371
372
  ),
372
- headers: (headers: Record<string, string>): T => wrap(jvmBuilder.headers(headers)),
373
+ headers: (headers: Record<string, string>): T => wrap(jvmBuilder.headers(asJava(headers) as any)),
373
374
  ignoreProtocolHeaders: (): T => wrap(jvmBuilder.ignoreProtocolHeaders()),
374
375
  basicAuth: (username: Expression<string>, password: Expression<string>): T =>
375
376
  wrap(
@@ -7,30 +7,31 @@ import JvmRequest = io.gatling.http.client.Request;
7
7
 
8
8
  export interface Request extends Wrapper<JvmRequest> {
9
9
  //copyWithCopiedHeaders(): Request;
10
- //copyWithHttp2PriorKnowledge(arg0: any /*io.gatling.http.client.Http2PriorKnowledge*/): Request;
11
- //copyWithNewBody(arg0: io.gatling.http.client.body.RequestBody): Request;
12
10
  //copyWithNewUri(arg0: any /*io.gatling.http.client.uri.Uri*/): Request;
13
- body(): RequestBody;
14
- //getCookies(): java.util.List<any /*io.netty.handler.codec.http.cookie.Cookie*/>;
11
+ //copyWithNewBody(arg0: io.gatling.http.client.body.RequestBody): Request;
12
+ //copyWithHttp2PriorKnowledge(arg0: any /*io.gatling.http.client.Http2PriorKnowledge*/): Request;
13
+ //getName(): string;
14
+ //getMethod(): any /*io.netty.handler.codec.http.HttpMethod*/;
15
+ //getUri(): any /*io.gatling.http.client.uri.Uri*/;
15
16
  headers(): HttpHeaders;
16
- //getHttp2PriorKnowledge(): any /*io.gatling.http.client.Http2PriorKnowledge*/;
17
+ //getCookies(): java.util.List<any /*io.netty.handler.codec.http.cookie.Cookie*/>;
18
+ body(): RequestBody;
19
+ //getRequestTimeout(): long;
20
+ //isAutoOrigin(): boolean;
17
21
  //getLocalAddresses(): any /*io.gatling.http.client.LocalAddresses*/;
18
- //getMethod(): any /*io.netty.handler.codec.http.HttpMethod*/;
19
- //getName(): string;
20
- //getNameResolver(): any /*io.gatling.http.client.resolver.InetAddressNameResolver*/;
21
- //getProxyServer(): any /*io.gatling.http.client.proxy.ProxyServer*/;
22
22
  //getRealm(): any /*io.gatling.http.client.realm.Realm*/;
23
- //getRequestTimeout(): long;
23
+ //getProxyServer(): any /*io.gatling.http.client.proxy.ProxyServer*/;
24
+ //getProxyProtocolSourceIpV4Address(): string;
25
+ //getProxyProtocolSourceIpV6Address(): string;
24
26
  //getSignatureCalculator(): Func<Request, Request>;
25
- //getUri(): any /*io.gatling.http.client.uri.Uri*/;
26
- //getVirtualHost(): string;
27
- //getWsSubprotocol(): string;
28
- //isAutoOrigin(): boolean;
27
+ //getNameResolver(): any /*io.gatling.http.client.resolver.InetAddressNameResolver*/;
29
28
  //isHttp2Enabled(): boolean;
29
+ //getHttp2PriorKnowledge(): any /*io.gatling.http.client.Http2PriorKnowledge*/;
30
+ //getWsSubprotocol(): string;
30
31
  }
31
32
 
32
33
  export const wrapRequest = (_underlying: JvmRequest): Request => ({
33
34
  _underlying,
34
- body: (): RequestBody => wrapRequestBody(_underlying.getBody()),
35
- headers: (): HttpHeaders => wrapHttpHeaders(_underlying.getHeaders())
35
+ headers: (): HttpHeaders => wrapHttpHeaders(_underlying.getHeaders()),
36
+ body: (): RequestBody => wrapRequestBody(_underlying.getBody())
36
37
  });
@@ -1,4 +1,4 @@
1
- import { CheckBuilder, Condition, ProtocolBuilder, Session, AllowListFilter, DenyListFilter } from "@gatling.io/core";
1
+ import { AllowListFilter, CheckBuilder, Condition, DenyListFilter, ProtocolBuilder, Session } from "@gatling.io/core";
2
2
  import { Proxy } from "./proxy";
3
3
  import JvmHttpProtocolBuilder = io.gatling.javaapi.http.HttpProtocolBuilder;
4
4
  /**
@@ -536,6 +536,13 @@ export interface HttpProtocolBuilder extends ProtocolBuilder {
536
536
  * @returns a new HttpProtocolBuilder instance
537
537
  */
538
538
  nameInferredHtmlResourcesAfterLastPathElement(): HttpProtocolBuilder;
539
+ /**
540
+ * Define a Proxy to be used for all requests
541
+ *
542
+ * @param proxy - the proxy
543
+ * @returns a new HttpProtocolBuilder instance
544
+ */
545
+ proxy(proxy: Proxy): HttpProtocolBuilder;
539
546
  /**
540
547
  * Ignore any configured proxy for some hosts
541
548
  *
@@ -544,12 +551,33 @@ export interface HttpProtocolBuilder extends ProtocolBuilder {
544
551
  */
545
552
  noProxyFor(...hosts: string[]): HttpProtocolBuilder;
546
553
  /**
547
- * Define a Proxy to be used for all requests
554
+ * Enable Proxy Protocol for IPv4
548
555
  *
549
- * @param proxy - the proxy
556
+ * @param address - a fake local address in IPv4 format
550
557
  * @returns a new HttpProtocolBuilder instance
551
558
  */
552
- proxy(proxy: Proxy): HttpProtocolBuilder;
559
+ proxyProtocolSourceIpV4Address(address: string): HttpProtocolBuilder;
560
+ /**
561
+ * Enable Proxy Protocol for IPv4
562
+ *
563
+ * @param address - a fake local address in IPv4 format
564
+ * @returns a new HttpProtocolBuilder instance
565
+ */
566
+ proxyProtocolSourceIpV4Address(address: (session: Session) => string): HttpProtocolBuilder;
567
+ /**
568
+ * Enable Proxy Protocol for IPv6
569
+ *
570
+ * @param address - a fake local address in IPv6 format
571
+ * @returns a new HttpProtocolBuilder instance
572
+ */
573
+ proxyProtocolSourceIpV6Address(address: string): HttpProtocolBuilder;
574
+ /**
575
+ * Enable Proxy Protocol for IPv6
576
+ *
577
+ * @param address - a fake local address in IPv6 format
578
+ * @returns a new HttpProtocolBuilder instance
579
+ */
580
+ proxyProtocolSourceIpV6Address(address: (session: Session) => string): HttpProtocolBuilder;
553
581
  /**
554
582
  * Enable Gatling non-blocking DNS resolution instead of using Java's blocking implementation
555
583
  *
@@ -23,7 +23,7 @@ const wrapHttpProtocolBuilder = (_underlying) => ({
23
23
  header: (name, value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
24
24
  ? _underlying.header(name, (0, core_1.underlyingSessionTo)(value))
25
25
  : _underlying.header(name, value)),
26
- headers: (headers) => (0, exports.wrapHttpProtocolBuilder)(_underlying.headers(headers)),
26
+ headers: (headers) => (0, exports.wrapHttpProtocolBuilder)(_underlying.headers((0, core_1.asJava)(headers))),
27
27
  acceptHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
28
28
  ? _underlying.acceptHeader((0, core_1.underlyingSessionTo)(value))
29
29
  : _underlying.acceptHeader(value)),
@@ -109,8 +109,14 @@ const wrapHttpProtocolBuilder = (_underlying) => ({
109
109
  nameInferredHtmlResourcesAfterPath: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.nameInferredHtmlResourcesAfterPath()),
110
110
  nameInferredHtmlResourcesAfterLastPathElement: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.nameInferredHtmlResourcesAfterLastPathElement()),
111
111
  // Proxy part
112
- noProxyFor: (...hosts) => (0, exports.wrapHttpProtocolBuilder)(_underlying.noProxyFor(...hosts)),
113
112
  proxy: (proxy) => (0, exports.wrapHttpProtocolBuilder)(_underlying.proxy(proxy._underlying)),
113
+ noProxyFor: (...hosts) => (0, exports.wrapHttpProtocolBuilder)(_underlying.noProxyFor(...hosts)),
114
+ proxyProtocolSourceIpV4Address: (address) => (0, exports.wrapHttpProtocolBuilder)(typeof address === "string"
115
+ ? _underlying.proxyProtocolSourceIpV4Address(address)
116
+ : _underlying.proxyProtocolSourceIpV4Address((0, core_1.underlyingSessionTo)(address))),
117
+ proxyProtocolSourceIpV6Address: (address) => (0, exports.wrapHttpProtocolBuilder)(typeof address === "string"
118
+ ? _underlying.proxyProtocolSourceIpV6Address(address)
119
+ : _underlying.proxyProtocolSourceIpV6Address((0, core_1.underlyingSessionTo)(address))),
114
120
  // DNS part
115
121
  asyncNameResolution: (...dnsServers) => (0, exports.wrapHttpProtocolBuilder)(_underlying.asyncNameResolution(...dnsServers)),
116
122
  hostNameAliases: (aliases) => (0, exports.wrapHttpProtocolBuilder)(_underlying.hostNameAliases(aliases)),
@@ -83,7 +83,7 @@ const requestWithParamsActionBuilderImpl = (jvmBuilder, wrap) => ({
83
83
  }
84
84
  },
85
85
  header: (name, value) => wrap(typeof value === "function" ? jvmBuilder.header(name, (0, core_1.underlyingSessionTo)(value)) : jvmBuilder.header(name, value)),
86
- headers: (headers) => wrap(jvmBuilder.headers(headers)),
86
+ headers: (headers) => wrap(jvmBuilder.headers((0, core_1.asJava)(headers))),
87
87
  ignoreProtocolHeaders: () => wrap(jvmBuilder.ignoreProtocolHeaders()),
88
88
  basicAuth: (username, password) => wrap(typeof username === "function"
89
89
  ? typeof password === "function"
@@ -3,7 +3,7 @@ import { HttpHeaders } from "../headers";
3
3
  import { RequestBody } from "./body";
4
4
  import JvmRequest = io.gatling.http.client.Request;
5
5
  export interface Request extends Wrapper<JvmRequest> {
6
- body(): RequestBody;
7
6
  headers(): HttpHeaders;
7
+ body(): RequestBody;
8
8
  }
9
9
  export declare const wrapRequest: (_underlying: JvmRequest) => Request;
@@ -5,7 +5,7 @@ const headers_1 = require("../headers");
5
5
  const body_1 = require("./body");
6
6
  const wrapRequest = (_underlying) => ({
7
7
  _underlying,
8
- body: () => (0, body_1.wrapRequestBody)(_underlying.getBody()),
9
- headers: () => (0, headers_1.wrapHttpHeaders)(_underlying.getHeaders())
8
+ headers: () => (0, headers_1.wrapHttpHeaders)(_underlying.getHeaders()),
9
+ body: () => (0, body_1.wrapRequestBody)(_underlying.getBody())
10
10
  });
11
11
  exports.wrapRequest = wrapRequest;