@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.
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.status = exports.headerRegex = exports.header = exports.currentLocationRegex = exports.currentLocation = void 0;
4
+ const jvm_types_1 = require("@gatling.io/jvm-types");
5
+ const core_1 = require("@gatling.io/core");
6
+ /**
7
+ * Bootstrap a check that capture the response location, eg the landing url in a chain of
8
+ * redirects
9
+ *
10
+ * @returns the next step in the check DSL
11
+ */
12
+ const currentLocation = () => (0, core_1.wrapCheckBuilderFind)(jvm_types_1.HttpDsl.currentLocation());
13
+ exports.currentLocation = currentLocation;
14
+ const currentLocationRegex = (pattern) => (0, core_1.wrapCheckBuilderCaptureGroup)(typeof pattern === "function"
15
+ ? jvm_types_1.HttpDsl.currentLocationRegex((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(pattern)))
16
+ : jvm_types_1.HttpDsl.currentLocationRegex(pattern));
17
+ exports.currentLocationRegex = currentLocationRegex;
18
+ const header = (name) => (0, core_1.wrapCheckBuilderMultipleFind)(typeof name === "function" ? jvm_types_1.HttpDsl.header((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(name))) : jvm_types_1.HttpDsl.header(name));
19
+ exports.header = header;
20
+ const headerRegex = (name, pattern) => (0, core_1.wrapCheckBuilderCaptureGroup)(typeof name === "function"
21
+ ? typeof pattern === "function"
22
+ ? jvm_types_1.HttpDsl.headerRegex((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(name)), (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(pattern)))
23
+ : jvm_types_1.HttpDsl.headerRegex((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(name)), pattern)
24
+ : typeof pattern === "function"
25
+ ? jvm_types_1.HttpDsl.headerRegex(name, (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(pattern)))
26
+ : // FIXME forced to use the charsequence version
27
+ jvm_types_1.HttpDsl.headerRegex(name, pattern));
28
+ exports.headerRegex = headerRegex;
29
+ /**
30
+ * Bootstrap a check that capture the response HTTP status code
31
+ *
32
+ * @returns the next step in the check DSL
33
+ */
34
+ const status = () => (0, core_1.wrapCheckBuilderFind)(jvm_types_1.HttpDsl.status());
35
+ exports.status = status;
@@ -0,0 +1,100 @@
1
+ import { ActionBuilder, Session, Wrapper } from "@gatling.io/core";
2
+ import JvmAddCookie = io.gatling.javaapi.http.AddCookie;
3
+ import JvmGetCookie = io.gatling.javaapi.http.GetCookie;
4
+ export interface AddCookie extends Wrapper<JvmAddCookie> {
5
+ withDomain(domain: string): AddCookie;
6
+ withPath(path: string): AddCookie;
7
+ withMaxAge(maxAge: number): AddCookie;
8
+ withSecure(secure: boolean): AddCookie;
9
+ }
10
+ export interface GetCookie extends Wrapper<JvmGetCookie> {
11
+ withDomain(domain: string): GetCookie;
12
+ withDomain(domain: (session: Session) => string): GetCookie;
13
+ withPath(path: string): GetCookie;
14
+ withSecure(secure: boolean): GetCookie;
15
+ saveAs(saveAs: string): GetCookie;
16
+ }
17
+ /**
18
+ * Create an action to add a Cookie
19
+ *
20
+ * @param cookie - the DSL for adding a cookie
21
+ * @returns an ActionBuilder
22
+ */
23
+ export declare const addCookie: (cookie: AddCookie) => ActionBuilder;
24
+ /**
25
+ * Create an action to get a Cookie value into the Session
26
+ *
27
+ * @param cookie - the DSL for getting a cookie
28
+ * @returns an ActionBuilder
29
+ */
30
+ export declare const getCookieValue: (cookie: GetCookie) => ActionBuilder;
31
+ /**
32
+ * Create an action to flush the Session (non-persistent) Cookies of the user
33
+ *
34
+ * @returns an ActionBuilder
35
+ */
36
+ export declare const flushSessionCookies: () => ActionBuilder;
37
+ /**
38
+ * Create an action to flush all the Cookies of the user
39
+ *
40
+ * @returns an ActionBuilder
41
+ */
42
+ export declare const flushCookieJar: () => ActionBuilder;
43
+ /**
44
+ * Create an action to flush the HTTP cache of the user
45
+ *
46
+ * @returns an ActionBuilder
47
+ */
48
+ export declare const flushHttpCache: () => ActionBuilder;
49
+ export interface CookieApply {
50
+ /**
51
+ * Bootstrap the DSL for defining a Cookie to add
52
+ *
53
+ * @param name - the name of the cookie, expressed as a Gatling Expression Language String
54
+ * @param value - the value of the cookie, expressed as a Gatling Expression Language String
55
+ * @returns the next DSL step
56
+ */
57
+ (name: string, value: string): AddCookie;
58
+ /**
59
+ * Bootstrap the DSL for defining a Cookie to add
60
+ *
61
+ * @param name - the name of the cookie, expressed as a function
62
+ * @param value - the value of the cookie, expressed as a Gatling Expression Language String
63
+ * @returns the next DSL step
64
+ */
65
+ (name: string, value: (session: Session) => string): AddCookie;
66
+ /**
67
+ * Bootstrap the DSL for defining a Cookie to add
68
+ *
69
+ * @param name - the name of the cookie, expressed as a Gatling Expression Language String
70
+ * @param value - the value of the cookie, expressed as a function
71
+ * @returns the next DSL step
72
+ */
73
+ (name: (session: Session) => string, value: string): AddCookie;
74
+ /**
75
+ * Bootstrap the DSL for defining a Cookie to add
76
+ *
77
+ * @param name - the name of the cookie, expressed as a function
78
+ * @param value - the value of the cookie, expressed as a function
79
+ * @returns the next DSL step
80
+ */
81
+ (name: (session: Session) => string, value: (session: Session) => string): AddCookie;
82
+ }
83
+ export declare const Cookie: CookieApply;
84
+ export interface CookieKeyApply {
85
+ /**
86
+ * Bootstrap the DSL for defining a Cookie to get
87
+ *
88
+ * @param name - the name of the cookie, expressed as a Gatling Expression Language String
89
+ * @returns the next DSL step
90
+ */
91
+ (name: string): GetCookie;
92
+ /**
93
+ * Bootstrap the DSL for defining a Cookie to get
94
+ *
95
+ * @param name - the name of the cookie, expressed as a function
96
+ * @returns the next DSL step
97
+ */
98
+ (name: (session: Session) => string): GetCookie;
99
+ }
100
+ export declare const CookieKey: CookieKeyApply;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CookieKey = exports.Cookie = exports.flushHttpCache = exports.flushCookieJar = exports.flushSessionCookies = exports.getCookieValue = exports.addCookie = void 0;
4
+ const core_1 = require("@gatling.io/core");
5
+ const jvm_types_1 = require("@gatling.io/jvm-types");
6
+ const wrapAddCookie = (_underlying) => ({
7
+ _underlying,
8
+ withDomain: (domain) => wrapAddCookie(_underlying.withDomain(domain)),
9
+ withPath: (path) => wrapAddCookie(_underlying.withPath(path)),
10
+ withMaxAge: (maxAge) => wrapAddCookie(_underlying.withMaxAge(maxAge)),
11
+ withSecure: (secure) => wrapAddCookie(_underlying.withSecure(secure))
12
+ });
13
+ const wrapGetCookie = (_underlying) => ({
14
+ _underlying,
15
+ withDomain: (domain) => wrapGetCookie(typeof domain === "function"
16
+ ? _underlying.withDomain((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(domain)))
17
+ : _underlying.withPath(domain)),
18
+ withPath: (path) => wrapGetCookie(_underlying.withPath(path)),
19
+ withSecure: (secure) => wrapGetCookie(_underlying.withSecure(secure)),
20
+ saveAs: (saveAs) => wrapGetCookie(_underlying.saveAs(saveAs))
21
+ });
22
+ /**
23
+ * Create an action to add a Cookie
24
+ *
25
+ * @param cookie - the DSL for adding a cookie
26
+ * @returns an ActionBuilder
27
+ */
28
+ const addCookie = (cookie) => (0, core_1.wrapActionBuilder)(jvm_types_1.HttpDsl.addCookie(cookie._underlying));
29
+ exports.addCookie = addCookie;
30
+ /**
31
+ * Create an action to get a Cookie value into the Session
32
+ *
33
+ * @param cookie - the DSL for getting a cookie
34
+ * @returns an ActionBuilder
35
+ */
36
+ const getCookieValue = (cookie) => (0, core_1.wrapActionBuilder)(jvm_types_1.HttpDsl.getCookieValue(cookie._underlying));
37
+ exports.getCookieValue = getCookieValue;
38
+ /**
39
+ * Create an action to flush the Session (non-persistent) Cookies of the user
40
+ *
41
+ * @returns an ActionBuilder
42
+ */
43
+ const flushSessionCookies = () => (0, core_1.wrapActionBuilder)(jvm_types_1.HttpDsl.flushSessionCookies());
44
+ exports.flushSessionCookies = flushSessionCookies;
45
+ /**
46
+ * Create an action to flush all the Cookies of the user
47
+ *
48
+ * @returns an ActionBuilder
49
+ */
50
+ const flushCookieJar = () => (0, core_1.wrapActionBuilder)(jvm_types_1.HttpDsl.flushCookieJar());
51
+ exports.flushCookieJar = flushCookieJar;
52
+ /**
53
+ * Create an action to flush the HTTP cache of the user
54
+ *
55
+ * @returns an ActionBuilder
56
+ */
57
+ const flushHttpCache = () => (0, core_1.wrapActionBuilder)(jvm_types_1.HttpDsl.flushHttpCache());
58
+ exports.flushHttpCache = flushHttpCache;
59
+ const Cookie = (name, value) => wrapAddCookie(typeof name === "function"
60
+ ? typeof value === "function"
61
+ ? jvm_types_1.HttpDsl.Cookie((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(name)), (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
62
+ : jvm_types_1.HttpDsl.Cookie((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(name)), value)
63
+ : typeof value === "function"
64
+ ? jvm_types_1.HttpDsl.Cookie(name, (0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(value)))
65
+ : jvm_types_1.HttpDsl.Cookie(name, value));
66
+ exports.Cookie = Cookie;
67
+ const CookieKey = (name) => wrapGetCookie(typeof name === "function"
68
+ ? jvm_types_1.HttpDsl.CookieKey((0, core_1.wrapCallback)((0, core_1.underlyingSessionTo)(name)))
69
+ : jvm_types_1.HttpDsl.CookieKey(name));
70
+ exports.CookieKey = CookieKey;
@@ -0,0 +1,9 @@
1
+ import { FileBasedFeederBuilder } from "@gatling.io/core";
2
+ /**
3
+ * Bootstrap a feeder that reads from a sitemap XML file
4
+ *
5
+ * @param filePath - the path of the file, either relative to the root of the classpath, or absolute, expressed as a
6
+ * Gatling Expression Language String
7
+ * @returns the next DSL step
8
+ */
9
+ export declare const sitemap: (filePath: string) => FileBasedFeederBuilder<string>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sitemap = void 0;
4
+ const jvm_types_1 = require("@gatling.io/jvm-types");
5
+ const core_1 = require("@gatling.io/core");
6
+ /**
7
+ * Bootstrap a feeder that reads from a sitemap XML file
8
+ *
9
+ * @param filePath - the path of the file, either relative to the root of the classpath, or absolute, expressed as a
10
+ * Gatling Expression Language String
11
+ * @returns the next DSL step
12
+ */
13
+ const sitemap = (filePath) => (0, core_1.wrapFileBasedFeederBuilder)(jvm_types_1.HttpDsl.sitemap(filePath));
14
+ exports.sitemap = sitemap;
@@ -0,0 +1,26 @@
1
+ import { Wrapper } from "@gatling.io/core";
2
+ import JvmHttpHeaders = io.netty.handler.codec.http.HttpHeaders;
3
+ /**
4
+ * Provides the constants for the standard HTTP header names and values and
5
+ * commonly used utility methods that accesses an {@link HttpMessage}.
6
+ * <p>
7
+ * Concrete instances of this class are most easily obtained from its default factory:
8
+ * {@link DefaultHttpHeadersFactory#headersFactory()}.
9
+ */
10
+ export interface HttpHeaders extends Wrapper<JvmHttpHeaders> {
11
+ /**
12
+ * Adds a new header with the specified name and value.
13
+ *
14
+ * If the specified value is not a {@link String}, it is converted
15
+ * into a {@link String} by {@link Object#toString()}, except in the cases
16
+ * of {@link Date} and {@link Calendar}, which are formatted to the date
17
+ * format defined in <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1">RFC2616</a>.
18
+ *
19
+ * @param name - The name of the header being added
20
+ * @param value - The value of the header being added
21
+ *
22
+ * @returns {@code this}
23
+ */
24
+ add(name: string, value: any): HttpHeaders;
25
+ }
26
+ export declare const wrapHttpHeaders: (_underlying: JvmHttpHeaders) => HttpHeaders;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapHttpHeaders = void 0;
4
+ const wrapHttpHeaders = (_underlying) => ({
5
+ _underlying,
6
+ add: (name, value) => (0, exports.wrapHttpHeaders)(_underlying.add(name, value))
7
+ });
8
+ exports.wrapHttpHeaders = wrapHttpHeaders;
@@ -0,0 +1,163 @@
1
+ import { Session } from "@gatling.io/core";
2
+ import { HttpProtocolBuilder } from "./protocol";
3
+ import { HttpRequestActionBuilder, Request } from "./request";
4
+ import { Response } from "./response";
5
+ export * from "./bodyPart";
6
+ export * from "./checks";
7
+ export * from "./cookies";
8
+ export * from "./feeders";
9
+ export * from "./headers";
10
+ export * from "./method";
11
+ export * from "./polling";
12
+ export * from "./protocol";
13
+ export * from "./proxy";
14
+ export * from "./request";
15
+ export * from "./response";
16
+ import JvmRequest = io.gatling.http.client.Request;
17
+ import JvmResponse = io.gatling.http.response.Response;
18
+ import JvmSession = io.gatling.javaapi.core.Session;
19
+ export type RequestTransform = (request: Request, session: Session) => Request;
20
+ export declare const underlyingRequestTransform: (f: RequestTransform) => ((jvmRequest: JvmRequest, jvmSession: JvmSession) => JvmRequest);
21
+ export type ResponseTransform = (response: Response, session: Session) => Response;
22
+ export declare const underlyingResponseTransform: (f: ResponseTransform) => ((jvmResponse: JvmResponse, jvmSession: JvmSession) => JvmResponse);
23
+ /**
24
+ * DSL for bootstrapping HTTP requests.
25
+ *
26
+ * <p>Immutable, so all methods return a new occurrence and leave the original unmodified.
27
+ */
28
+ export interface Http {
29
+ /**
30
+ * Define a GET request
31
+ *
32
+ * @param url - the url, expressed as a Gatling Expression Language String
33
+ * @returns a new instance of HttpRequestActionBuilder
34
+ */
35
+ get(url: string): HttpRequestActionBuilder;
36
+ /**
37
+ * Define a GET request
38
+ *
39
+ * @param url - the url, expressed as a function
40
+ * @returns a new instance of HttpRequestActionBuilder
41
+ */
42
+ get(url: (session: Session) => string): HttpRequestActionBuilder;
43
+ /**
44
+ * Define a PUT request
45
+ *
46
+ * @param url - the url, expressed as a Gatling Expression Language String
47
+ * @returns a new instance of HttpRequestActionBuilder
48
+ */
49
+ put(url: string): HttpRequestActionBuilder;
50
+ /**
51
+ * Define a PUT request
52
+ *
53
+ * @param url - the url, expressed as a function
54
+ * @returns a new instance of HttpRequestActionBuilder
55
+ */
56
+ put(url: (session: Session) => string): HttpRequestActionBuilder;
57
+ /**
58
+ * Define a POST request
59
+ *
60
+ * @param url - the url, expressed as a Gatling Expression Language String
61
+ * @returns a new instance of HttpRequestActionBuilder
62
+ */
63
+ post(url: string): HttpRequestActionBuilder;
64
+ /**
65
+ * Define a POST request
66
+ *
67
+ * @param url - the url, expressed as a function
68
+ * @returns a new instance of HttpRequestActionBuilder
69
+ */
70
+ post(url: (session: Session) => string): HttpRequestActionBuilder;
71
+ /**
72
+ * Define a PATCH request
73
+ *
74
+ * @param url - the url, expressed as a Gatling Expression Language String
75
+ * @returns a new instance of HttpRequestActionBuilder
76
+ */
77
+ patch(url: string): HttpRequestActionBuilder;
78
+ /**
79
+ * Define a PATCH request
80
+ *
81
+ * @param url - the url, expressed as a function
82
+ * @returns a new instance of HttpRequestActionBuilder
83
+ */
84
+ patch(url: (session: Session) => string): HttpRequestActionBuilder;
85
+ /**
86
+ * Define a HEAD request
87
+ *
88
+ * @param url - the url, expressed as a Gatling Expression Language String
89
+ * @returns a new instance of HttpRequestActionBuilder
90
+ */
91
+ head(url: string): HttpRequestActionBuilder;
92
+ /**
93
+ * Define a HEAD request
94
+ *
95
+ * @param url - the url, expressed as a function
96
+ * @returns a new instance of HttpRequestActionBuilder
97
+ */
98
+ head(url: (session: Session) => string): HttpRequestActionBuilder;
99
+ /**
100
+ * Define a DELETE request
101
+ *
102
+ * @param url - the url, expressed as a Gatling Expression Language String
103
+ * @returns a new instance of HttpRequestActionBuilder
104
+ */
105
+ delete(url: string): HttpRequestActionBuilder;
106
+ /**
107
+ * Define a DELETE request
108
+ *
109
+ * @param url - the url, expressed as a function
110
+ * @returns a new instance of HttpRequestActionBuilder
111
+ */
112
+ delete(url: (session: Session) => string): HttpRequestActionBuilder;
113
+ /**
114
+ * Define a OPTIONS request
115
+ *
116
+ * @param url - the url, expressed as a Gatling Expression Language String
117
+ * @returns a new instance of HttpRequestActionBuilder
118
+ */
119
+ options(url: string): HttpRequestActionBuilder;
120
+ /**
121
+ * Define a OPTIONS request
122
+ *
123
+ * @param url - the url, expressed as a function
124
+ * @returns a new instance of HttpRequestActionBuilder
125
+ */
126
+ options(url: (session: Session) => string): HttpRequestActionBuilder;
127
+ /**
128
+ * Define a HTTP request
129
+ *
130
+ * @param method - the HTTP method
131
+ * @param url - the url, expressed as a Gatling Expression Language String
132
+ * @returns a new instance of HttpRequestActionBuilder
133
+ */
134
+ httpRequest(method: string, url: string): HttpRequestActionBuilder;
135
+ /**
136
+ * Define a HTTP request
137
+ *
138
+ * @param method - the HTTP method
139
+ * @param url - the url, expressed as a function
140
+ * @returns a new instance of HttpRequestActionBuilder
141
+ */
142
+ httpRequest(method: string, url: (session: Session) => string): HttpRequestActionBuilder;
143
+ }
144
+ /**
145
+ * The entrypoint of the Gatling HTTP DSL
146
+ */
147
+ export interface HttpApply {
148
+ /**
149
+ * Bootstrap a HTTP request configuration
150
+ *
151
+ * @param name - the HTTP request name, expressed as a Gatling Expression Language String
152
+ * @returns the next DSL step
153
+ */
154
+ (name: string): Http;
155
+ /**
156
+ * Bootstrap a HTTP request configuration
157
+ *
158
+ * @param name - the HTTP request name, expressed as a function
159
+ * @returns the next DSL step
160
+ */
161
+ (name: (session: Session) => string): Http;
162
+ }
163
+ export declare const http: HttpApply & HttpProtocolBuilder;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.http = exports.underlyingResponseTransform = exports.underlyingRequestTransform = void 0;
18
+ const core_1 = require("@gatling.io/core");
19
+ const core_2 = require("@gatling.io/core");
20
+ const jvm_types_1 = require("@gatling.io/jvm-types");
21
+ const protocol_1 = require("./protocol");
22
+ const request_1 = require("./request");
23
+ const response_1 = require("./response");
24
+ __exportStar(require("./bodyPart"), exports);
25
+ __exportStar(require("./checks"), exports);
26
+ __exportStar(require("./cookies"), exports);
27
+ __exportStar(require("./feeders"), exports);
28
+ __exportStar(require("./headers"), exports);
29
+ __exportStar(require("./method"), exports);
30
+ __exportStar(require("./polling"), exports);
31
+ __exportStar(require("./protocol"), exports);
32
+ __exportStar(require("./proxy"), exports);
33
+ __exportStar(require("./request"), exports);
34
+ __exportStar(require("./response"), exports);
35
+ const underlyingRequestTransform = (f) => (jvmRequest, jvmSession) => f((0, request_1.wrapRequest)(jvmRequest), (0, core_1.wrapSession)(jvmSession))._underlying;
36
+ exports.underlyingRequestTransform = underlyingRequestTransform;
37
+ const underlyingResponseTransform = (f) => (jvmResponse, jvmSession) => f((0, response_1.wrapResponse)(jvmResponse), (0, core_1.wrapSession)(jvmSession))._underlying;
38
+ exports.underlyingResponseTransform = underlyingResponseTransform;
39
+ const httpProtocolBuilder = (0, protocol_1.wrapHttpProtocolBuilder)(
40
+ // HttpDsl.http doesn't get properly generated by java2ts because of conflicts with methods of the same name
41
+ Java.type("io.gatling.javaapi.http.HttpDsl").http);
42
+ const wrapHttp = (jvmHttp) => ({
43
+ get: (url) => (0, request_1.wrapHttpRequestActionBuilder)(typeof url === "function" ? jvmHttp.get((0, core_1.wrapCallback)((0, core_2.underlyingSessionTo)(url))) : jvmHttp.get(url)),
44
+ put: (url) => (0, request_1.wrapHttpRequestActionBuilder)(typeof url === "function" ? jvmHttp.put((0, core_1.wrapCallback)((0, core_2.underlyingSessionTo)(url))) : jvmHttp.put(url)),
45
+ post: (url) => (0, request_1.wrapHttpRequestActionBuilder)(typeof url === "function" ? jvmHttp.post((0, core_1.wrapCallback)((0, core_2.underlyingSessionTo)(url))) : jvmHttp.post(url)),
46
+ patch: (url) => (0, request_1.wrapHttpRequestActionBuilder)(typeof url === "function" ? jvmHttp.patch((0, core_1.wrapCallback)((0, core_2.underlyingSessionTo)(url))) : jvmHttp.patch(url)),
47
+ head: (url) => (0, request_1.wrapHttpRequestActionBuilder)(typeof url === "function" ? jvmHttp.head((0, core_1.wrapCallback)((0, core_2.underlyingSessionTo)(url))) : jvmHttp.head(url)),
48
+ delete: (url) => (0, request_1.wrapHttpRequestActionBuilder)(typeof url === "function" ? jvmHttp.delete((0, core_1.wrapCallback)((0, core_2.underlyingSessionTo)(url))) : jvmHttp.delete(url)),
49
+ options: (url) => (0, request_1.wrapHttpRequestActionBuilder)(typeof url === "function" ? jvmHttp.options((0, core_1.wrapCallback)((0, core_2.underlyingSessionTo)(url))) : jvmHttp.options(url)),
50
+ httpRequest: (method, url) => (0, request_1.wrapHttpRequestActionBuilder)(typeof url === "function"
51
+ ? jvmHttp.httpRequest(method, (0, core_1.wrapCallback)((0, core_2.underlyingSessionTo)(url)))
52
+ : jvmHttp.httpRequest(method, url))
53
+ });
54
+ const httpApply = (name) => {
55
+ // Handle overloading
56
+ const jvmHttp = typeof name === "string" ? jvm_types_1.HttpDsl.http(name) : jvm_types_1.HttpDsl.http((0, core_1.wrapCallback)((0, core_2.underlyingSessionTo)(name)));
57
+ return wrapHttp(jvmHttp);
58
+ };
59
+ exports.http = Object.assign(httpApply, httpProtocolBuilder);
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The OPTIONS method represents a request for information about the communication options
3
+ * available on the request/response chain identified by the Request-URI. This method allows
4
+ * the client to determine the options and/or requirements associated with a resource, or the
5
+ * capabilities of a server, without implying a resource action or initiating a resource
6
+ * retrieval.
7
+ */
8
+ export type OPTIONS = "OPTIONS";
9
+ /**
10
+ * The GET method means retrieve whatever information (in the form of an entity) is identified
11
+ * by the Request-URI. If the Request-URI refers to a data-producing process, it is the
12
+ * produced data which shall be returned as the entity in the response and not the source text
13
+ * of the process, unless that text happens to be the output of the process.
14
+ */
15
+ export type GET = "GET";
16
+ /**
17
+ * The HEAD method is identical to GET except that the server MUST NOT return a message-body
18
+ * in the response.
19
+ */
20
+ export type HEAD = "HEAD";
21
+ /**
22
+ * The POST method is used to request that the origin server accept the entity enclosed in the
23
+ * request as a new subordinate of the resource identified by the Request-URI in the
24
+ * Request-Line.
25
+ */
26
+ export type POST = "POST";
27
+ /**
28
+ * The PUT method requests that the enclosed entity be stored under the supplied Request-URI.
29
+ */
30
+ export type PUT = "PUT";
31
+ /**
32
+ * The PATCH method requests that a set of changes described in the
33
+ * request entity be applied to the resource identified by the Request-URI.
34
+ */
35
+ export type PATCH = "PATCH";
36
+ /**
37
+ * The DELETE method requests that the origin server delete the resource identified by the
38
+ * Request-URI.
39
+ */
40
+ export type DELETE = "DELETE";
41
+ /**
42
+ * The TRACE method is used to invoke a remote, application-layer loop-back of the request
43
+ * message.
44
+ */
45
+ export type TRACE = "TRACE";
46
+ /**
47
+ * This specification reserves the method name CONNECT for use with a proxy that can dynamically
48
+ * switch to being a tunnel
49
+ */
50
+ export type CONNECT = "CONNECT";
51
+ /**
52
+ * The request method of HTTP or its derived protocols, such as
53
+ * <a href="https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol">RTSP</a> and
54
+ * <a href="https://en.wikipedia.org/wiki/Internet_Content_Adaptation_Protocol">ICAP</a>.
55
+ */
56
+ export type HttpMethod = OPTIONS | GET | HEAD | POST | PUT | PATCH | DELETE | TRACE | CONNECT;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,39 @@
1
+ import { ActionBuilder, Duration } from "@gatling.io/core";
2
+ import { HttpRequestActionBuilder } from "./request";
3
+ /** The prefix to bootstrap polling specific DSL */
4
+ export declare const poll: () => Polling;
5
+ /**
6
+ * DSL for building HTTP polling configurations
7
+ *
8
+ * Immutable, so all methods return a new occurrence and leave the original unmodified.
9
+ */
10
+ export interface Polling {
11
+ /**
12
+ * Define a custom poller name so multiple pollers for the same virtual users don't conflict
13
+ *
14
+ * @param pollerName - the name
15
+ * @returns the next DSL step
16
+ */
17
+ pollerName(pollerName: string): Polling;
18
+ /**
19
+ * Define the polling period
20
+ *
21
+ * @param period - the period
22
+ * @returns the next DSL step
23
+ */
24
+ every(period: Duration): PollingEvery;
25
+ /**
26
+ * Stop polling
27
+ *
28
+ * @returns an ActionBuilder
29
+ */
30
+ stop(): ActionBuilder;
31
+ }
32
+ export interface PollingEvery {
33
+ /**
34
+ * Define the polling request
35
+ *
36
+ * @returns an ActionBuilder
37
+ */
38
+ exec(requestBuilder: HttpRequestActionBuilder): ActionBuilder;
39
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.poll = void 0;
4
+ const jvm_types_1 = require("@gatling.io/jvm-types");
5
+ const core_1 = require("@gatling.io/core");
6
+ /** The prefix to bootstrap polling specific DSL */
7
+ const poll = () => wrapPolling(jvm_types_1.HttpDsl.poll());
8
+ exports.poll = poll;
9
+ const wrapPolling = (_underlying) => ({
10
+ pollerName: (pollerName) => wrapPolling(_underlying.pollerName(pollerName)),
11
+ every: (period) => wrapPollingEvery(_underlying.every((0, core_1.toJvmDuration)(period))),
12
+ stop: () => (0, core_1.wrapActionBuilder)(_underlying.stop())
13
+ });
14
+ const wrapPollingEvery = (_underlying) => ({
15
+ exec: (requestBuilder) => (0, core_1.wrapActionBuilder)(_underlying.exec(requestBuilder._underlying))
16
+ });