@gatling.io/http 0.1.0
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 +25 -0
- package/target/bodyPart.d.ts +418 -0
- package/target/bodyPart.js +110 -0
- package/target/checks.d.ts +97 -0
- package/target/checks.js +35 -0
- package/target/cookies.d.ts +100 -0
- package/target/cookies.js +70 -0
- package/target/feeders.d.ts +9 -0
- package/target/feeders.js +14 -0
- package/target/headers.d.ts +26 -0
- package/target/headers.js +8 -0
- package/target/index.d.ts +163 -0
- package/target/index.js +59 -0
- package/target/method.d.ts +56 -0
- package/target/method.js +2 -0
- package/target/polling.d.ts +39 -0
- package/target/polling.js +16 -0
- package/target/protocol.d.ts +575 -0
- package/target/protocol.js +119 -0
- package/target/proxy.d.ts +44 -0
- package/target/proxy.js +21 -0
- package/target/request/body.d.ts +6 -0
- package/target/request/body.js +8 -0
- package/target/request/index.d.ts +521 -0
- package/target/request/index.js +207 -0
- package/target/request/request.d.ts +9 -0
- package/target/request/request.js +11 -0
- package/target/response/body.d.ts +9 -0
- package/target/response/body.js +11 -0
- package/target/response/index.d.ts +15 -0
- package/target/response/index.js +46 -0
- package/target/response/status.d.ts +236 -0
- package/target/response/status.js +361 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapHttpProtocolBuilder = void 0;
|
|
4
|
+
const core_1 = require("@gatling.io/core");
|
|
5
|
+
const wrapHttpProtocolBuilder = (_underlying) => ({
|
|
6
|
+
_underlying,
|
|
7
|
+
baseUrl: (url) => (0, exports.wrapHttpProtocolBuilder)(_underlying.baseUrl(url)),
|
|
8
|
+
baseUrls: (...urls) => (0, exports.wrapHttpProtocolBuilder)(_underlying.baseUrls(...urls)),
|
|
9
|
+
warmUp: (url) => (0, exports.wrapHttpProtocolBuilder)(_underlying.warmUp(url)),
|
|
10
|
+
disableWarmUp: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.disableWarmUp()),
|
|
11
|
+
// Engine part
|
|
12
|
+
shareConnections: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.shareConnections()),
|
|
13
|
+
localAddress: (address) => (0, exports.wrapHttpProtocolBuilder)(_underlying.localAddress(address)),
|
|
14
|
+
localAddresses: (...addresses) => (0, exports.wrapHttpProtocolBuilder)(_underlying.localAddresses(...addresses)),
|
|
15
|
+
useAllLocalAddresses: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.useAllLocalAddresses()),
|
|
16
|
+
useAllLocalAddressesMatching: (...patterns) => (0, exports.wrapHttpProtocolBuilder)(_underlying.useAllLocalAddressesMatching(...patterns)),
|
|
17
|
+
maxConnectionsPerHost: (max) => (0, exports.wrapHttpProtocolBuilder)(_underlying.maxConnectionsPerHost(max)),
|
|
18
|
+
// TODO perUserKeyManagerFactory
|
|
19
|
+
// Request part
|
|
20
|
+
disableAutoOrigin: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.disableAutoOrigin()),
|
|
21
|
+
disableAutoReferer: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.disableAutoReferer()),
|
|
22
|
+
disableCaching: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.disableCaching()),
|
|
23
|
+
header: (name, value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
24
|
+
? _underlying.header(name, (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
25
|
+
: _underlying.header(name, value)),
|
|
26
|
+
headers: (headers) => (0, exports.wrapHttpProtocolBuilder)(_underlying.headers(headers)),
|
|
27
|
+
acceptHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
28
|
+
? _underlying.acceptHeader((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
29
|
+
: _underlying.acceptHeader(value)),
|
|
30
|
+
acceptCharsetHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
31
|
+
? _underlying.acceptCharsetHeader((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
32
|
+
: _underlying.acceptCharsetHeader(value)),
|
|
33
|
+
acceptEncodingHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
34
|
+
? _underlying.acceptEncodingHeader((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
35
|
+
: _underlying.acceptEncodingHeader(value)),
|
|
36
|
+
acceptLanguageHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
37
|
+
? _underlying.acceptLanguageHeader((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
38
|
+
: _underlying.acceptLanguageHeader(value)),
|
|
39
|
+
authorizationHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
40
|
+
? _underlying.authorizationHeader((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
41
|
+
: _underlying.authorizationHeader(value)),
|
|
42
|
+
connectionHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
43
|
+
? _underlying.connectionHeader((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
44
|
+
: _underlying.connectionHeader(value)),
|
|
45
|
+
contentTypeHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
46
|
+
? _underlying.contentTypeHeader((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
47
|
+
: _underlying.contentTypeHeader(value)),
|
|
48
|
+
doNotTrackHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
49
|
+
? _underlying.doNotTrackHeader((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
50
|
+
: _underlying.doNotTrackHeader(value)),
|
|
51
|
+
originHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
52
|
+
? _underlying.originHeader((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
53
|
+
: _underlying.originHeader(value)),
|
|
54
|
+
userAgentHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
55
|
+
? _underlying.userAgentHeader((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
56
|
+
: _underlying.userAgentHeader(value)),
|
|
57
|
+
upgradeInsecureRequestsHeader: (value) => (0, exports.wrapHttpProtocolBuilder)(typeof value === "function"
|
|
58
|
+
? _underlying.upgradeInsecureRequestsHeader((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
|
|
59
|
+
: _underlying.upgradeInsecureRequestsHeader(value)),
|
|
60
|
+
basicAuth: (username, password) => (0, exports.wrapHttpProtocolBuilder)(typeof username === "function"
|
|
61
|
+
? typeof password === "function"
|
|
62
|
+
? _underlying.basicAuth((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(username)), (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(password)))
|
|
63
|
+
: _underlying.basicAuth((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(username)), password)
|
|
64
|
+
: typeof password === "function"
|
|
65
|
+
? _underlying.basicAuth(username, (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(password)))
|
|
66
|
+
: _underlying.basicAuth(username, password)),
|
|
67
|
+
digestAuth: (username, password) => (0, exports.wrapHttpProtocolBuilder)(typeof username === "function"
|
|
68
|
+
? typeof password === "function"
|
|
69
|
+
? _underlying.digestAuth((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(username)), (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(password)))
|
|
70
|
+
: _underlying.digestAuth((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(username)), password)
|
|
71
|
+
: typeof password === "function"
|
|
72
|
+
? _underlying.digestAuth(username, (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(password)))
|
|
73
|
+
: _underlying.digestAuth(username, password)),
|
|
74
|
+
silentResources: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.silentResources()),
|
|
75
|
+
silentUri: (pattern) => (0, exports.wrapHttpProtocolBuilder)(_underlying.silentUri(pattern)),
|
|
76
|
+
disableUrlEncoding: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.disableUrlEncoding()),
|
|
77
|
+
//sign: (calculator: (request: Request, session: Session) => Request): HttpProtocolBuilder =>
|
|
78
|
+
// wrapHttpProtocolBuilder(_underlying.sign(wrapBiCallback(underlyingRequestTransform(calculator)))),
|
|
79
|
+
signWithOAuth1: (consumerKey, clientSharedSecret, token, tokenSecret, useAuthorizationHeader) => (0, exports.wrapHttpProtocolBuilder)(typeof consumerKey === "function" &&
|
|
80
|
+
typeof clientSharedSecret === "function" &&
|
|
81
|
+
typeof token === "function" &&
|
|
82
|
+
typeof tokenSecret === "function"
|
|
83
|
+
? typeof useAuthorizationHeader !== "undefined"
|
|
84
|
+
? _underlying.signWithOAuth1((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(consumerKey)), (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(clientSharedSecret)), (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(token)), (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(tokenSecret)), useAuthorizationHeader)
|
|
85
|
+
: _underlying.signWithOAuth1((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(consumerKey)), (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(clientSharedSecret)), (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(token)), (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(tokenSecret)))
|
|
86
|
+
: typeof useAuthorizationHeader !== "undefined"
|
|
87
|
+
? _underlying.signWithOAuth1(consumerKey, clientSharedSecret, token, tokenSecret, useAuthorizationHeader)
|
|
88
|
+
: _underlying.signWithOAuth1(consumerKey, clientSharedSecret, token, tokenSecret)),
|
|
89
|
+
enableHttp2: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.enableHttp2()),
|
|
90
|
+
http2PriorKnowledge: (remotes) => (0, exports.wrapHttpProtocolBuilder)(_underlying.http2PriorKnowledge(remotes)),
|
|
91
|
+
// Response part
|
|
92
|
+
disableFollowRedirect: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.disableFollowRedirect()),
|
|
93
|
+
maxRedirects: (max) => (0, exports.wrapHttpProtocolBuilder)(_underlying.maxRedirects(max)),
|
|
94
|
+
strict302Handling: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.strict302Handling()),
|
|
95
|
+
//transformResponse: (f: (response: Response, session: Session) => Response): HttpProtocolBuilder =>
|
|
96
|
+
// wrapHttpProtocolBuilder(_underlying.transformResponse(wrapBiCallback(underlyingResponseTransform(f)))),
|
|
97
|
+
check: (...checks) => (0, exports.wrapHttpProtocolBuilder)(_underlying.check(checks.map((c) => c._underlying))),
|
|
98
|
+
checkIf: (condition) => (0, core_1.wrapCondition)(typeof condition === "string"
|
|
99
|
+
? _underlying.checkIf(condition)
|
|
100
|
+
: _underlying.checkIf((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(condition))), exports.wrapHttpProtocolBuilder),
|
|
101
|
+
inferHtmlResources: (arg0, arg1) => (0, exports.wrapHttpProtocolBuilder)(arg0 !== undefined
|
|
102
|
+
? arg1 !== undefined
|
|
103
|
+
? _underlying.inferHtmlResources(arg0._underlying, arg1._underlying)
|
|
104
|
+
: _underlying.inferHtmlResources(arg0._underlying)
|
|
105
|
+
: _underlying.inferHtmlResources()),
|
|
106
|
+
nameInferredHtmlResourcesAfterUrlTail: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.nameInferredHtmlResourcesAfterUrlTail()),
|
|
107
|
+
nameInferredHtmlResourcesAfterAbsoluteUrl: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.nameInferredHtmlResourcesAfterAbsoluteUrl()),
|
|
108
|
+
nameInferredHtmlResourcesAfterRelativeUrl: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.nameInferredHtmlResourcesAfterRelativeUrl()),
|
|
109
|
+
nameInferredHtmlResourcesAfterPath: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.nameInferredHtmlResourcesAfterPath()),
|
|
110
|
+
nameInferredHtmlResourcesAfterLastPathElement: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.nameInferredHtmlResourcesAfterLastPathElement()),
|
|
111
|
+
// Proxy part
|
|
112
|
+
noProxyFor: (...hosts) => (0, exports.wrapHttpProtocolBuilder)(_underlying.noProxyFor(...hosts)),
|
|
113
|
+
proxy: (proxy) => (0, exports.wrapHttpProtocolBuilder)(_underlying.proxy(proxy._underlying)),
|
|
114
|
+
// DNS part
|
|
115
|
+
asyncNameResolution: (...dnsServers) => (0, exports.wrapHttpProtocolBuilder)(_underlying.asyncNameResolution(...dnsServers)),
|
|
116
|
+
hostNameAliases: (aliases) => (0, exports.wrapHttpProtocolBuilder)(_underlying.hostNameAliases(aliases)),
|
|
117
|
+
perUserNameResolution: () => (0, exports.wrapHttpProtocolBuilder)(_underlying.perUserNameResolution())
|
|
118
|
+
});
|
|
119
|
+
exports.wrapHttpProtocolBuilder = wrapHttpProtocolBuilder;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Wrapper } from "@gatling.io/core";
|
|
2
|
+
import JvmProxy = io.gatling.javaapi.http.Proxy;
|
|
3
|
+
export interface Proxy extends Wrapper<JvmProxy> {
|
|
4
|
+
/**
|
|
5
|
+
* Define this proxy is an HTTP one (default)
|
|
6
|
+
*
|
|
7
|
+
* @returns a new Proxy instance
|
|
8
|
+
*/
|
|
9
|
+
http(): Proxy;
|
|
10
|
+
/**
|
|
11
|
+
* Define this proxy is an HTTPS one
|
|
12
|
+
*
|
|
13
|
+
* @returns a new Proxy instance
|
|
14
|
+
*/
|
|
15
|
+
https(): Proxy;
|
|
16
|
+
/**
|
|
17
|
+
* Define this proxy is an SOCKS4 once
|
|
18
|
+
*
|
|
19
|
+
* @returns a new Proxy instance
|
|
20
|
+
*/
|
|
21
|
+
socks4(): Proxy;
|
|
22
|
+
/**
|
|
23
|
+
* Define this proxy is an SOCKS5 once
|
|
24
|
+
*
|
|
25
|
+
* @returns a new Proxy instance
|
|
26
|
+
*/
|
|
27
|
+
socks5(): Proxy;
|
|
28
|
+
/**
|
|
29
|
+
* Define some Basic Auth credentials for this proxy
|
|
30
|
+
*
|
|
31
|
+
* @param username - the username
|
|
32
|
+
* @param password - the password
|
|
33
|
+
* @returns a new Proxy instance
|
|
34
|
+
*/
|
|
35
|
+
credentials(username: string, password: string): Proxy;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Bootstrap the DSL for defining a Proxy
|
|
39
|
+
*
|
|
40
|
+
* @param host - the proxy host
|
|
41
|
+
* @param port - the proxy prot
|
|
42
|
+
* @returns the next DSL step
|
|
43
|
+
*/
|
|
44
|
+
export declare const Proxy: (host: string, port: number) => Proxy;
|
package/target/proxy.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Proxy = void 0;
|
|
4
|
+
const jvm_types_1 = require("@gatling.io/jvm-types");
|
|
5
|
+
const wrapProxy = (_underlying) => ({
|
|
6
|
+
_underlying,
|
|
7
|
+
http: () => wrapProxy(_underlying.http()),
|
|
8
|
+
https: () => wrapProxy(_underlying.https()),
|
|
9
|
+
socks4: () => wrapProxy(_underlying.socks4()),
|
|
10
|
+
socks5: () => wrapProxy(_underlying.socks5()),
|
|
11
|
+
credentials: (username, password) => wrapProxy(_underlying.credentials(username, password))
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Bootstrap the DSL for defining a Proxy
|
|
15
|
+
*
|
|
16
|
+
* @param host - the proxy host
|
|
17
|
+
* @param port - the proxy prot
|
|
18
|
+
* @returns the next DSL step
|
|
19
|
+
*/
|
|
20
|
+
const Proxy = (host, port) => wrapProxy(jvm_types_1.HttpDsl.Proxy(host, port));
|
|
21
|
+
exports.Proxy = Proxy;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Wrapper } from "@gatling.io/core";
|
|
2
|
+
import JvmRequestBody = io.gatling.http.client.body.RequestBody;
|
|
3
|
+
export interface RequestBody extends Wrapper<JvmRequestBody> {
|
|
4
|
+
bytes(): number[];
|
|
5
|
+
}
|
|
6
|
+
export declare const wrapRequestBody: (_underlying: JvmRequestBody) => RequestBody;
|