@gatling.io/http 3.11.7 → 3.12.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/jest.config.js +5 -0
- package/package.json +4 -4
- package/src/bodyPart.ts +590 -0
- package/src/checks.ts +142 -0
- package/src/cookies.ts +227 -0
- package/src/feeders.ts +13 -0
- package/src/headers.ts +32 -0
- package/src/index.test.ts +425 -0
- package/src/index.ts +242 -0
- package/src/method.ts +65 -0
- package/src/polling.ts +59 -0
- package/src/protocol.ts +966 -0
- package/src/proxy.ts +61 -0
- package/src/request/body.ts +12 -0
- package/src/request/index.ts +837 -0
- package/src/request/request.ts +36 -0
- package/src/response/body.ts +19 -0
- package/src/response/index.ts +61 -0
- package/src/response/status.ts +428 -0
- package/tsconfig.json +18 -0
package/src/method.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* The GET method means retrieve whatever information (in the form of an entity) is identified
|
|
12
|
+
* by the Request-URI. If the Request-URI refers to a data-producing process, it is the
|
|
13
|
+
* produced data which shall be returned as the entity in the response and not the source text
|
|
14
|
+
* of the process, unless that text happens to be the output of the process.
|
|
15
|
+
*/
|
|
16
|
+
export type GET = "GET";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The HEAD method is identical to GET except that the server MUST NOT return a message-body
|
|
20
|
+
* in the response.
|
|
21
|
+
*/
|
|
22
|
+
export type HEAD = "HEAD";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The POST method is used to request that the origin server accept the entity enclosed in the
|
|
26
|
+
* request as a new subordinate of the resource identified by the Request-URI in the
|
|
27
|
+
* Request-Line.
|
|
28
|
+
*/
|
|
29
|
+
export type POST = "POST";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The PUT method requests that the enclosed entity be stored under the supplied Request-URI.
|
|
33
|
+
*/
|
|
34
|
+
export type PUT = "PUT";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The PATCH method requests that a set of changes described in the
|
|
38
|
+
* request entity be applied to the resource identified by the Request-URI.
|
|
39
|
+
*/
|
|
40
|
+
export type PATCH = "PATCH";
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The DELETE method requests that the origin server delete the resource identified by the
|
|
44
|
+
* Request-URI.
|
|
45
|
+
*/
|
|
46
|
+
export type DELETE = "DELETE";
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The TRACE method is used to invoke a remote, application-layer loop-back of the request
|
|
50
|
+
* message.
|
|
51
|
+
*/
|
|
52
|
+
export type TRACE = "TRACE";
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* This specification reserves the method name CONNECT for use with a proxy that can dynamically
|
|
56
|
+
* switch to being a tunnel
|
|
57
|
+
*/
|
|
58
|
+
export type CONNECT = "CONNECT";
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The request method of HTTP or its derived protocols, such as
|
|
62
|
+
* <a href="https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol">RTSP</a> and
|
|
63
|
+
* <a href="https://en.wikipedia.org/wiki/Internet_Content_Adaptation_Protocol">ICAP</a>.
|
|
64
|
+
*/
|
|
65
|
+
export type HttpMethod = OPTIONS | GET | HEAD | POST | PUT | PATCH | DELETE | TRACE | CONNECT;
|
package/src/polling.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { HttpDsl as JvmHttpDsl } from "@gatling.io/jvm-types";
|
|
2
|
+
import JvmPolling = io.gatling.javaapi.http.Polling;
|
|
3
|
+
import JvmPollingEvery = io.gatling.javaapi.http.Polling$Every;
|
|
4
|
+
|
|
5
|
+
import { ActionBuilder, Duration, wrapActionBuilder, toJvmDuration } from "@gatling.io/core";
|
|
6
|
+
|
|
7
|
+
import { HttpRequestActionBuilder } from "./request";
|
|
8
|
+
|
|
9
|
+
/** The prefix to bootstrap polling specific DSL */
|
|
10
|
+
export const poll = (): Polling => wrapPolling(JvmHttpDsl.poll());
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* DSL for building HTTP polling configurations
|
|
14
|
+
*
|
|
15
|
+
* Immutable, so all methods return a new occurrence and leave the original unmodified.
|
|
16
|
+
*/
|
|
17
|
+
export interface Polling {
|
|
18
|
+
/**
|
|
19
|
+
* Define a custom poller name so multiple pollers for the same virtual users don't conflict
|
|
20
|
+
*
|
|
21
|
+
* @param pollerName - the name
|
|
22
|
+
* @returns the next DSL step
|
|
23
|
+
*/
|
|
24
|
+
pollerName(pollerName: string): Polling;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Define the polling period
|
|
28
|
+
*
|
|
29
|
+
* @param period - the period
|
|
30
|
+
* @returns the next DSL step
|
|
31
|
+
*/
|
|
32
|
+
every(period: Duration): PollingEvery;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Stop polling
|
|
36
|
+
*
|
|
37
|
+
* @returns an ActionBuilder
|
|
38
|
+
*/
|
|
39
|
+
stop(): ActionBuilder;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const wrapPolling = (_underlying: JvmPolling): Polling => ({
|
|
43
|
+
pollerName: (pollerName) => wrapPolling(_underlying.pollerName(pollerName)),
|
|
44
|
+
every: (period) => wrapPollingEvery(_underlying.every(toJvmDuration(period))),
|
|
45
|
+
stop: () => wrapActionBuilder(_underlying.stop())
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export interface PollingEvery {
|
|
49
|
+
/**
|
|
50
|
+
* Define the polling request
|
|
51
|
+
*
|
|
52
|
+
* @returns an ActionBuilder
|
|
53
|
+
*/
|
|
54
|
+
exec(requestBuilder: HttpRequestActionBuilder): ActionBuilder;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const wrapPollingEvery = (_underlying: JvmPollingEvery): PollingEvery => ({
|
|
58
|
+
exec: (requestBuilder) => wrapActionBuilder(_underlying.exec(requestBuilder._underlying))
|
|
59
|
+
});
|