@serenity-js/rest 3.25.0 → 3.25.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/CHANGELOG.md +22 -0
- package/README.md +1 -1
- package/lib/screenplay/abilities/CallAnApi.d.ts +17 -15
- package/lib/screenplay/abilities/CallAnApi.d.ts.map +1 -1
- package/lib/screenplay/abilities/CallAnApi.js +17 -15
- package/lib/screenplay/abilities/CallAnApi.js.map +1 -1
- package/lib/screenplay/interactions/ChangeApiConfig.d.ts +11 -11
- package/lib/screenplay/interactions/ChangeApiConfig.js +11 -11
- package/lib/screenplay/interactions/Send.d.ts +3 -3
- package/lib/screenplay/interactions/Send.js +3 -3
- package/lib/screenplay/models/DeleteRequest.d.ts +6 -6
- package/lib/screenplay/models/DeleteRequest.js +6 -6
- package/lib/screenplay/models/GetRequest.d.ts +6 -6
- package/lib/screenplay/models/GetRequest.js +6 -6
- package/lib/screenplay/models/HTTPRequest.d.ts +3 -3
- package/lib/screenplay/models/HTTPRequest.js +3 -3
- package/lib/screenplay/models/HeadRequest.d.ts +6 -6
- package/lib/screenplay/models/HeadRequest.js +6 -6
- package/lib/screenplay/models/OptionsRequest.d.ts +6 -6
- package/lib/screenplay/models/OptionsRequest.js +6 -6
- package/lib/screenplay/models/PatchRequest.d.ts +6 -6
- package/lib/screenplay/models/PatchRequest.js +6 -6
- package/lib/screenplay/models/PostRequest.d.ts +6 -6
- package/lib/screenplay/models/PostRequest.js +6 -6
- package/lib/screenplay/models/PutRequest.d.ts +6 -6
- package/lib/screenplay/models/PutRequest.js +6 -6
- package/lib/screenplay/questions/LastResponse.d.ts +6 -6
- package/lib/screenplay/questions/LastResponse.js +6 -6
- package/package.json +6 -6
- package/src/screenplay/abilities/CallAnApi.ts +17 -15
- package/src/screenplay/interactions/ChangeApiConfig.ts +11 -11
- package/src/screenplay/interactions/Send.ts +3 -3
- package/src/screenplay/models/DeleteRequest.ts +6 -6
- package/src/screenplay/models/GetRequest.ts +6 -6
- package/src/screenplay/models/HTTPRequest.ts +3 -3
- package/src/screenplay/models/HeadRequest.ts +6 -6
- package/src/screenplay/models/OptionsRequest.ts +6 -6
- package/src/screenplay/models/PatchRequest.ts +6 -6
- package/src/screenplay/models/PostRequest.ts +6 -6
- package/src/screenplay/models/PutRequest.ts +6 -6
- package/src/screenplay/questions/LastResponse.ts +6 -6
|
@@ -34,20 +34,20 @@ export declare class HeadRequest extends HTTPRequest {
|
|
|
34
34
|
*
|
|
35
35
|
* When the `resourceUri` is not a fully qualified URL but a path, such as `/products/2`,
|
|
36
36
|
* it gets concatenated with the URL provided to the Axios instance
|
|
37
|
-
* when the
|
|
37
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
38
38
|
*
|
|
39
39
|
* @param resourceUri
|
|
40
|
-
* The URI where the
|
|
41
|
-
* should send the
|
|
40
|
+
* The URI where the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
41
|
+
* should send the [`HTTPRequest`](https://serenity-js.org/api/rest/class/HTTPRequest/)
|
|
42
42
|
*/
|
|
43
43
|
static to(resourceUri: Answerable<string>): HeadRequest;
|
|
44
44
|
/**
|
|
45
45
|
* Overrides the default Axios request configuration provided
|
|
46
|
-
* when the
|
|
46
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
47
47
|
*
|
|
48
48
|
* #### Learn more
|
|
49
|
-
* -
|
|
50
|
-
* -
|
|
49
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
50
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
51
51
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
52
52
|
*
|
|
53
53
|
* @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
|
|
@@ -36,22 +36,22 @@ class HeadRequest extends HTTPRequest_1.HTTPRequest {
|
|
|
36
36
|
*
|
|
37
37
|
* When the `resourceUri` is not a fully qualified URL but a path, such as `/products/2`,
|
|
38
38
|
* it gets concatenated with the URL provided to the Axios instance
|
|
39
|
-
* when the
|
|
39
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
40
40
|
*
|
|
41
41
|
* @param resourceUri
|
|
42
|
-
* The URI where the
|
|
43
|
-
* should send the
|
|
42
|
+
* The URI where the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
43
|
+
* should send the [`HTTPRequest`](https://serenity-js.org/api/rest/class/HTTPRequest/)
|
|
44
44
|
*/
|
|
45
45
|
static to(resourceUri) {
|
|
46
46
|
return new HeadRequest(resourceUri);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Overrides the default Axios request configuration provided
|
|
50
|
-
* when the
|
|
50
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
51
51
|
*
|
|
52
52
|
* #### Learn more
|
|
53
|
-
* -
|
|
54
|
-
* -
|
|
53
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
54
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
55
55
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
56
56
|
*
|
|
57
57
|
* @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
|
|
@@ -37,20 +37,20 @@ export declare class OptionsRequest extends HTTPRequest {
|
|
|
37
37
|
*
|
|
38
38
|
* When the `resourceUri` is not a fully qualified URL but a path, such as `/products/2`,
|
|
39
39
|
* it gets concatenated with the URL provided to the Axios instance
|
|
40
|
-
* when the
|
|
40
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
41
41
|
*
|
|
42
42
|
* @param resourceUri
|
|
43
|
-
* The URI where the
|
|
44
|
-
* should send the
|
|
43
|
+
* The URI where the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
44
|
+
* should send the [`HTTPRequest`](https://serenity-js.org/api/rest/class/HTTPRequest/)
|
|
45
45
|
*/
|
|
46
46
|
static to(resourceUri: Answerable<string>): OptionsRequest;
|
|
47
47
|
/**
|
|
48
48
|
* Overrides the default Axios request configuration provided
|
|
49
|
-
* when the
|
|
49
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
50
50
|
*
|
|
51
51
|
* #### Learn more
|
|
52
|
-
* -
|
|
53
|
-
* -
|
|
52
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
53
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
54
54
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
55
55
|
*
|
|
56
56
|
* @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
|
|
@@ -39,22 +39,22 @@ class OptionsRequest extends HTTPRequest_1.HTTPRequest {
|
|
|
39
39
|
*
|
|
40
40
|
* When the `resourceUri` is not a fully qualified URL but a path, such as `/products/2`,
|
|
41
41
|
* it gets concatenated with the URL provided to the Axios instance
|
|
42
|
-
* when the
|
|
42
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
43
43
|
*
|
|
44
44
|
* @param resourceUri
|
|
45
|
-
* The URI where the
|
|
46
|
-
* should send the
|
|
45
|
+
* The URI where the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
46
|
+
* should send the [`HTTPRequest`](https://serenity-js.org/api/rest/class/HTTPRequest/)
|
|
47
47
|
*/
|
|
48
48
|
static to(resourceUri) {
|
|
49
49
|
return new OptionsRequest(resourceUri);
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Overrides the default Axios request configuration provided
|
|
53
|
-
* when the
|
|
53
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
54
54
|
*
|
|
55
55
|
* #### Learn more
|
|
56
|
-
* -
|
|
57
|
-
* -
|
|
56
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
57
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
58
58
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
59
59
|
*
|
|
60
60
|
* @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
|
|
@@ -34,11 +34,11 @@ export declare class PatchRequest extends HTTPRequest {
|
|
|
34
34
|
*
|
|
35
35
|
* When the `resourceUri` is not a fully qualified URL but a path, such as `/products/2`,
|
|
36
36
|
* it gets concatenated with the URL provided to the Axios instance
|
|
37
|
-
* when the
|
|
37
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
38
38
|
*
|
|
39
39
|
* @param resourceUri
|
|
40
|
-
* The URI where the
|
|
41
|
-
* should send the
|
|
40
|
+
* The URI where the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
41
|
+
* should send the [`HTTPRequest`](https://serenity-js.org/api/rest/class/HTTPRequest/)
|
|
42
42
|
*/
|
|
43
43
|
static to(resourceUri: Answerable<string>): PatchRequest;
|
|
44
44
|
/**
|
|
@@ -50,11 +50,11 @@ export declare class PatchRequest extends HTTPRequest {
|
|
|
50
50
|
with(data: Answerable<any>): PatchRequest;
|
|
51
51
|
/**
|
|
52
52
|
* Overrides the default Axios request configuration provided
|
|
53
|
-
* when the
|
|
53
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
54
54
|
*
|
|
55
55
|
* #### Learn more
|
|
56
|
-
* -
|
|
57
|
-
* -
|
|
56
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
57
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
58
58
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
59
59
|
*
|
|
60
60
|
* @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
|
|
@@ -36,11 +36,11 @@ class PatchRequest extends HTTPRequest_1.HTTPRequest {
|
|
|
36
36
|
*
|
|
37
37
|
* When the `resourceUri` is not a fully qualified URL but a path, such as `/products/2`,
|
|
38
38
|
* it gets concatenated with the URL provided to the Axios instance
|
|
39
|
-
* when the
|
|
39
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
40
40
|
*
|
|
41
41
|
* @param resourceUri
|
|
42
|
-
* The URI where the
|
|
43
|
-
* should send the
|
|
42
|
+
* The URI where the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
43
|
+
* should send the [`HTTPRequest`](https://serenity-js.org/api/rest/class/HTTPRequest/)
|
|
44
44
|
*/
|
|
45
45
|
static to(resourceUri) {
|
|
46
46
|
return new PatchRequest(resourceUri);
|
|
@@ -56,11 +56,11 @@ class PatchRequest extends HTTPRequest_1.HTTPRequest {
|
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* Overrides the default Axios request configuration provided
|
|
59
|
-
* when the
|
|
59
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
60
60
|
*
|
|
61
61
|
* #### Learn more
|
|
62
|
-
* -
|
|
63
|
-
* -
|
|
62
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
63
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
64
64
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
65
65
|
*
|
|
66
66
|
* @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
|
|
@@ -74,11 +74,11 @@ export declare class PostRequest extends HTTPRequest {
|
|
|
74
74
|
*
|
|
75
75
|
* When the `resourceUri` is not a fully qualified URL but a path, such as `/products/2`,
|
|
76
76
|
* it gets concatenated with the URL provided to the Axios instance
|
|
77
|
-
* when the
|
|
77
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
78
78
|
*
|
|
79
79
|
* @param resourceUri
|
|
80
|
-
* The URI where the
|
|
81
|
-
* should send the
|
|
80
|
+
* The URI where the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
81
|
+
* should send the [`HTTPRequest`](https://serenity-js.org/api/rest/class/HTTPRequest/)
|
|
82
82
|
*/
|
|
83
83
|
static to(resourceUri: Answerable<string>): PostRequest;
|
|
84
84
|
/**
|
|
@@ -90,11 +90,11 @@ export declare class PostRequest extends HTTPRequest {
|
|
|
90
90
|
with(data: Answerable<any>): PostRequest;
|
|
91
91
|
/**
|
|
92
92
|
* Overrides the default Axios request configuration provided
|
|
93
|
-
* when the
|
|
93
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
94
94
|
*
|
|
95
95
|
* #### Learn more
|
|
96
|
-
* -
|
|
97
|
-
* -
|
|
96
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
97
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
98
98
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
99
99
|
*
|
|
100
100
|
* @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
|
|
@@ -76,11 +76,11 @@ class PostRequest extends HTTPRequest_1.HTTPRequest {
|
|
|
76
76
|
*
|
|
77
77
|
* When the `resourceUri` is not a fully qualified URL but a path, such as `/products/2`,
|
|
78
78
|
* it gets concatenated with the URL provided to the Axios instance
|
|
79
|
-
* when the
|
|
79
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
80
80
|
*
|
|
81
81
|
* @param resourceUri
|
|
82
|
-
* The URI where the
|
|
83
|
-
* should send the
|
|
82
|
+
* The URI where the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
83
|
+
* should send the [`HTTPRequest`](https://serenity-js.org/api/rest/class/HTTPRequest/)
|
|
84
84
|
*/
|
|
85
85
|
static to(resourceUri) {
|
|
86
86
|
return new PostRequest(resourceUri);
|
|
@@ -96,11 +96,11 @@ class PostRequest extends HTTPRequest_1.HTTPRequest {
|
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Overrides the default Axios request configuration provided
|
|
99
|
-
* when the
|
|
99
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
100
100
|
*
|
|
101
101
|
* #### Learn more
|
|
102
|
-
* -
|
|
103
|
-
* -
|
|
102
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
103
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
104
104
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
105
105
|
*
|
|
106
106
|
* @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
|
|
@@ -44,11 +44,11 @@ export declare class PutRequest extends HTTPRequest {
|
|
|
44
44
|
*
|
|
45
45
|
* When the `resourceUri` is not a fully qualified URL but a path, such as `/products/2`,
|
|
46
46
|
* it gets concatenated with the URL provided to the Axios instance
|
|
47
|
-
* when the
|
|
47
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
48
48
|
*
|
|
49
49
|
* @param resourceUri
|
|
50
|
-
* The URI where the
|
|
51
|
-
* should send the
|
|
50
|
+
* The URI where the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
51
|
+
* should send the [`HTTPRequest`](https://serenity-js.org/api/rest/class/HTTPRequest/)
|
|
52
52
|
*/
|
|
53
53
|
static to(resourceUri: Answerable<string>): PutRequest;
|
|
54
54
|
/**
|
|
@@ -60,11 +60,11 @@ export declare class PutRequest extends HTTPRequest {
|
|
|
60
60
|
with(data: Answerable<any>): PutRequest;
|
|
61
61
|
/**
|
|
62
62
|
* Overrides the default Axios request configuration provided
|
|
63
|
-
* when the
|
|
63
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
64
64
|
*
|
|
65
65
|
* #### Learn more
|
|
66
|
-
* -
|
|
67
|
-
* -
|
|
66
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
67
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
68
68
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
69
69
|
*
|
|
70
70
|
* @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
|
|
@@ -46,11 +46,11 @@ class PutRequest extends HTTPRequest_1.HTTPRequest {
|
|
|
46
46
|
*
|
|
47
47
|
* When the `resourceUri` is not a fully qualified URL but a path, such as `/products/2`,
|
|
48
48
|
* it gets concatenated with the URL provided to the Axios instance
|
|
49
|
-
* when the
|
|
49
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
50
50
|
*
|
|
51
51
|
* @param resourceUri
|
|
52
|
-
* The URI where the
|
|
53
|
-
* should send the
|
|
52
|
+
* The URI where the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
53
|
+
* should send the [`HTTPRequest`](https://serenity-js.org/api/rest/class/HTTPRequest/)
|
|
54
54
|
*/
|
|
55
55
|
static to(resourceUri) {
|
|
56
56
|
return new PutRequest(resourceUri);
|
|
@@ -66,11 +66,11 @@ class PutRequest extends HTTPRequest_1.HTTPRequest {
|
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* Overrides the default Axios request configuration provided
|
|
69
|
-
* when the
|
|
69
|
+
* when the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
70
70
|
*
|
|
71
71
|
* #### Learn more
|
|
72
|
-
* -
|
|
73
|
-
* -
|
|
72
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
73
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
74
74
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
75
75
|
*
|
|
76
76
|
* @param {Answerable<WithAnswerableProperties<AxiosRequestConfig>>} config
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { QuestionAdapter } from '@serenity-js/core';
|
|
2
2
|
import type { RawAxiosResponseHeaders } from 'axios';
|
|
3
3
|
/**
|
|
4
|
-
* Provides access to the properties of the last
|
|
5
|
-
* cached on the
|
|
4
|
+
* Provides access to the properties of the last [`AxiosResponse`](https://axios-http.com/docs/res_schema) object,
|
|
5
|
+
* cached on the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/).
|
|
6
6
|
*
|
|
7
7
|
* ## Verify response to a GET request
|
|
8
8
|
*
|
|
@@ -64,14 +64,14 @@ import type { RawAxiosResponseHeaders } from 'axios';
|
|
|
64
64
|
*/
|
|
65
65
|
export declare class LastResponse {
|
|
66
66
|
/**
|
|
67
|
-
* Retrieves the status code of the
|
|
67
|
+
* Retrieves the status code of the [last response](https://serenity-js.org/api/rest/class/LastResponse/)
|
|
68
68
|
*
|
|
69
69
|
* #### Learn more
|
|
70
70
|
* - [HTTP response status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
71
71
|
*/
|
|
72
72
|
static status(): QuestionAdapter<number>;
|
|
73
73
|
/**
|
|
74
|
-
* Retrieves the body of the
|
|
74
|
+
* Retrieves the body of the [last response](https://serenity-js.org/api/rest/class/LastResponse/)
|
|
75
75
|
*
|
|
76
76
|
* #### A type-safe approach using generics
|
|
77
77
|
*
|
|
@@ -146,7 +146,7 @@ export declare class LastResponse {
|
|
|
146
146
|
*/
|
|
147
147
|
static body<T = any>(): QuestionAdapter<T>;
|
|
148
148
|
/**
|
|
149
|
-
* Retrieves a header of the
|
|
149
|
+
* Retrieves a header of the [last response](https://serenity-js.org/api/rest/class/LastResponse/), identified by `name`
|
|
150
150
|
*
|
|
151
151
|
* ## Asserting on a header
|
|
152
152
|
*
|
|
@@ -167,7 +167,7 @@ export declare class LastResponse {
|
|
|
167
167
|
*/
|
|
168
168
|
static header(name: string): QuestionAdapter<string>;
|
|
169
169
|
/**
|
|
170
|
-
* Retrieves all the headers of the
|
|
170
|
+
* Retrieves all the headers of the [last response](https://serenity-js.org/api/rest/class/LastResponse/).
|
|
171
171
|
*
|
|
172
172
|
* ## Asserting on a header
|
|
173
173
|
*
|
|
@@ -4,8 +4,8 @@ exports.LastResponse = void 0;
|
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
const abilities_1 = require("../abilities");
|
|
6
6
|
/**
|
|
7
|
-
* Provides access to the properties of the last
|
|
8
|
-
* cached on the
|
|
7
|
+
* Provides access to the properties of the last [`AxiosResponse`](https://axios-http.com/docs/res_schema) object,
|
|
8
|
+
* cached on the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/).
|
|
9
9
|
*
|
|
10
10
|
* ## Verify response to a GET request
|
|
11
11
|
*
|
|
@@ -67,7 +67,7 @@ const abilities_1 = require("../abilities");
|
|
|
67
67
|
*/
|
|
68
68
|
class LastResponse {
|
|
69
69
|
/**
|
|
70
|
-
* Retrieves the status code of the
|
|
70
|
+
* Retrieves the status code of the [last response](https://serenity-js.org/api/rest/class/LastResponse/)
|
|
71
71
|
*
|
|
72
72
|
* #### Learn more
|
|
73
73
|
* - [HTTP response status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
@@ -78,7 +78,7 @@ class LastResponse {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
-
* Retrieves the body of the
|
|
81
|
+
* Retrieves the body of the [last response](https://serenity-js.org/api/rest/class/LastResponse/)
|
|
82
82
|
*
|
|
83
83
|
* #### A type-safe approach using generics
|
|
84
84
|
*
|
|
@@ -157,7 +157,7 @@ class LastResponse {
|
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
/**
|
|
160
|
-
* Retrieves a header of the
|
|
160
|
+
* Retrieves a header of the [last response](https://serenity-js.org/api/rest/class/LastResponse/), identified by `name`
|
|
161
161
|
*
|
|
162
162
|
* ## Asserting on a header
|
|
163
163
|
*
|
|
@@ -182,7 +182,7 @@ class LastResponse {
|
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
|
-
* Retrieves all the headers of the
|
|
185
|
+
* Retrieves all the headers of the [last response](https://serenity-js.org/api/rest/class/LastResponse/).
|
|
186
186
|
*
|
|
187
187
|
* ## Asserting on a header
|
|
188
188
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/rest",
|
|
3
|
-
"version": "3.25.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.25.2",
|
|
4
|
+
"description": "Serenity/JS Screenplay Pattern library for interacting with REST and other HTTP-based services, supporting comprehensive API testing and blended testing scenarios",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
7
7
|
"email": "jan.molak@smartcodeltd.co.uk",
|
|
@@ -46,18 +46,18 @@
|
|
|
46
46
|
"node": "^16.13 || ^18.12 || ^20"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@serenity-js/core": "3.25.
|
|
49
|
+
"@serenity-js/core": "3.25.2",
|
|
50
50
|
"agent-base": "7.1.1",
|
|
51
51
|
"axios": "1.7.2",
|
|
52
52
|
"http-proxy-agent": "7.0.2",
|
|
53
53
|
"https-proxy-agent": "7.0.5",
|
|
54
|
-
"lru-cache": "10.3
|
|
54
|
+
"lru-cache": "10.4.3",
|
|
55
55
|
"proxy-from-env": "1.1.0",
|
|
56
56
|
"tiny-types": "1.22.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@integration/testing-tools": "3.0.0",
|
|
60
|
-
"@serenity-js/assertions": "3.25.
|
|
60
|
+
"@serenity-js/assertions": "3.25.2",
|
|
61
61
|
"@types/chai": "4.3.16",
|
|
62
62
|
"@types/mocha": "10.0.7",
|
|
63
63
|
"axios-mock-adapter": "1.22.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"ts-node": "10.9.2",
|
|
68
68
|
"typescript": "5.2.2"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "98b68da1e04a8fcbb255dca509b7bc9c322a3b6b"
|
|
71
71
|
}
|
|
@@ -11,8 +11,9 @@ import type { AxiosRequestConfigDefaults} from '../../io';
|
|
|
11
11
|
import { createAxios } from '../../io';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* An
|
|
15
|
-
* the
|
|
14
|
+
* An [ability](https://serenity-js.org/api/core/class/Ability/) that wraps [axios client](https://axios-http.com/docs/api_intro) and enables
|
|
15
|
+
* the [actor](https://serenity-js.org/api/core/class/Actor/) to [send](https://serenity-js.org/api/rest/class/Send/)
|
|
16
|
+
* [HTTP requests](https://serenity-js.org/api/rest/class/HTTPRequest/) to HTTP APIs.
|
|
16
17
|
*
|
|
17
18
|
* `CallAnApi` uses [`proxy-from-env`](https://www.npmjs.com/package/proxy-from-env) and an approach
|
|
18
19
|
* described in ["Node.js Axios behind corporate proxies"](https://janmolak.com/node-js-axios-behind-corporate-proxies-8b17a6f31f9d)
|
|
@@ -191,7 +192,7 @@ import { createAxios } from '../../io';
|
|
|
191
192
|
*
|
|
192
193
|
* ### Serenity/JS defaults
|
|
193
194
|
*
|
|
194
|
-
* When using
|
|
195
|
+
* When using [`CallAnApi.at`](https://serenity-js.org/api/rest/class/CallAnApi/#at) or [`CallAnApi.using`](https://serenity-js.org/api/rest/class/CallAnApi/#using) with a configuration object, Serenity/JS
|
|
195
196
|
* merges your [Axios request configuration](https://axios-http.com/docs/req_config) with the following defaults:
|
|
196
197
|
* - `timeout`: 10 seconds
|
|
197
198
|
*
|
|
@@ -228,7 +229,7 @@ import { createAxios } from '../../io';
|
|
|
228
229
|
*
|
|
229
230
|
* ### Using API-specific actors
|
|
230
231
|
*
|
|
231
|
-
* To create API-specific actors, configure your [test runner](/handbook/test-runners/) with a
|
|
232
|
+
* To create API-specific actors, configure your [test runner](https://serenity-js.org/handbook/test-runners/) with a [cast](https://serenity-js.org/api/core/class/Cast/)
|
|
232
233
|
* that gives your actors appropriate abilities based, for example, on their name:
|
|
233
234
|
*
|
|
234
235
|
* ```ts
|
|
@@ -252,7 +253,7 @@ import { createAxios } from '../../io';
|
|
|
252
253
|
* beforeEach(() => engage(new MyActors()))
|
|
253
254
|
* ```
|
|
254
255
|
*
|
|
255
|
-
* Next, retrieve the appropriate actor in your test scenario using
|
|
256
|
+
* Next, retrieve the appropriate actor in your test scenario using [`actorCalled`](https://serenity-js.org/api/core/function/actorCalled/), for example:
|
|
256
257
|
*
|
|
257
258
|
* ```ts
|
|
258
259
|
* import { describe, it, beforeEach } from 'mocha'
|
|
@@ -324,7 +325,7 @@ export class CallAnApi extends Ability {
|
|
|
324
325
|
private lastResponse: AxiosResponse;
|
|
325
326
|
|
|
326
327
|
/**
|
|
327
|
-
* Produces an
|
|
328
|
+
* Produces an [ability](https://serenity-js.org/api/core/class/Ability/) to call a REST API at a specified `baseURL`;
|
|
328
329
|
*
|
|
329
330
|
* This is the same as invoking `CallAnApi.using({ baseURL: 'https://example.org' })`
|
|
330
331
|
*
|
|
@@ -339,7 +340,7 @@ export class CallAnApi extends Ability {
|
|
|
339
340
|
}
|
|
340
341
|
|
|
341
342
|
/**
|
|
342
|
-
* Produces an
|
|
343
|
+
* Produces an [ability](https://serenity-js.org/api/core/class/Ability/) to call an HTTP API using the given Axios instance,
|
|
343
344
|
* or an Axios request configuration object.
|
|
344
345
|
*
|
|
345
346
|
* When you provide an [Axios configuration object](https://axios-http.com/docs/req_config),
|
|
@@ -351,7 +352,7 @@ export class CallAnApi extends Ability {
|
|
|
351
352
|
* When you provide an Axios instance, it's enhanced with proxy support and no other modifications are made.
|
|
352
353
|
*
|
|
353
354
|
* If you don't want Serenity/JS to augment or modify your Axios instance in any way,
|
|
354
|
-
* please use the
|
|
355
|
+
* please use the [`CallAnApi.constructor`](https://serenity-js.org/api/rest/class/CallAnApi/#constructor) directly.
|
|
355
356
|
*
|
|
356
357
|
* @param axiosInstanceOrConfig
|
|
357
358
|
*/
|
|
@@ -372,8 +373,8 @@ export class CallAnApi extends Ability {
|
|
|
372
373
|
|
|
373
374
|
/**
|
|
374
375
|
* Allows for the original Axios config to be changed after
|
|
375
|
-
* the
|
|
376
|
-
* has been instantiated and given to the
|
|
376
|
+
* the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
377
|
+
* has been instantiated and given to the [`Actor`](https://serenity-js.org/api/core/class/Actor/).
|
|
377
378
|
*
|
|
378
379
|
* #### Learn more
|
|
379
380
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
@@ -386,7 +387,7 @@ export class CallAnApi extends Ability {
|
|
|
386
387
|
|
|
387
388
|
/**
|
|
388
389
|
* Sends an HTTP request to a specified url.
|
|
389
|
-
* Response will be cached and available via
|
|
390
|
+
* Response will be cached and available via [`CallAnApi.mapLastResponse`](https://serenity-js.org/api/rest/class/CallAnApi/#mapLastResponse).
|
|
390
391
|
*
|
|
391
392
|
* #### Learn more
|
|
392
393
|
* - [AxiosRequestConfig](https://axios-http.com/docs/req_config)
|
|
@@ -394,7 +395,8 @@ export class CallAnApi extends Ability {
|
|
|
394
395
|
*
|
|
395
396
|
* @param config
|
|
396
397
|
* Axios request configuration, which can be used to override the defaults
|
|
397
|
-
* provided when the
|
|
398
|
+
* provided when the [ability](https://serenity-js.org/api/core/class/Ability/)
|
|
399
|
+
* to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) was instantiated.
|
|
398
400
|
*/
|
|
399
401
|
async request(config: AxiosRequestConfig): Promise<AxiosResponse> {
|
|
400
402
|
let url: string;
|
|
@@ -429,8 +431,8 @@ export class CallAnApi extends Ability {
|
|
|
429
431
|
}
|
|
430
432
|
|
|
431
433
|
/**
|
|
432
|
-
* Resolves the final URL, based on the
|
|
433
|
-
* and any defaults that the
|
|
434
|
+
* Resolves the final URL, based on the [`AxiosRequestConfig`](https://axios-http.com/docs/req_config) provided
|
|
435
|
+
* and any defaults that the [`AxiosInstance`](https://axios-http.com/docs/instance) has been configured with.
|
|
434
436
|
*
|
|
435
437
|
* Note that unlike Axios, this method uses the Node.js [WHATWG URL API](https://nodejs.org/api/url.html#new-urlinput-base)
|
|
436
438
|
* to ensure URLs are correctly resolved.
|
|
@@ -447,7 +449,7 @@ export class CallAnApi extends Ability {
|
|
|
447
449
|
|
|
448
450
|
/**
|
|
449
451
|
* Maps the last cached response to another type.
|
|
450
|
-
* Useful when you need to extract a portion of the
|
|
452
|
+
* Useful when you need to extract a portion of the [`AxiosResponse`](https://axios-http.com/docs/res_schema) object.
|
|
451
453
|
*
|
|
452
454
|
* #### Learn more
|
|
453
455
|
* - [AxiosResponse](https://axios-http.com/docs/res_schema)
|
|
@@ -5,8 +5,8 @@ import { URL } from 'url';
|
|
|
5
5
|
import { CallAnApi } from '../abilities';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Changes configuration of the
|
|
9
|
-
* that the
|
|
8
|
+
* Changes configuration of the [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
9
|
+
* that the [actor](https://serenity-js.org/api/core/class/Actor/) executing this [interaction](https://serenity-js.org/api/core/class/Interaction/) has been configured with.
|
|
10
10
|
*
|
|
11
11
|
* ## Changing API URL for all subsequent requests
|
|
12
12
|
*
|
|
@@ -90,7 +90,7 @@ import { CallAnApi } from '../abilities';
|
|
|
90
90
|
* ## Handling sensitive information
|
|
91
91
|
*
|
|
92
92
|
* By design, any data handled by an actor appears in Serenity/JS reports.
|
|
93
|
-
* To prevent the exposure of any sensitive information, such as passwords or tokens, you should use
|
|
93
|
+
* To prevent the exposure of any sensitive information, such as passwords or tokens, you should use [`Masked`](https://serenity-js.org/api/core/class/Masked/).
|
|
94
94
|
*
|
|
95
95
|
* ```ts
|
|
96
96
|
* import { actorCalled, Masked } from '@serenity-js/core'
|
|
@@ -113,8 +113,8 @@ import { CallAnApi } from '../abilities';
|
|
|
113
113
|
export class ChangeApiConfig {
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
|
-
* Instructs the
|
|
117
|
-
* of their
|
|
116
|
+
* Instructs the [actor](https://serenity-js.org/api/core/class/Actor/) to change the base URL
|
|
117
|
+
* of their [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
118
118
|
*
|
|
119
119
|
* @param newApiUrl
|
|
120
120
|
*/
|
|
@@ -123,8 +123,8 @@ export class ChangeApiConfig {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
|
-
* Instructs the
|
|
127
|
-
* of their
|
|
126
|
+
* Instructs the [actor](https://serenity-js.org/api/core/class/Actor/) to change the port configured in the base URL
|
|
127
|
+
* of their [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
128
128
|
*
|
|
129
129
|
* @param newApiPort
|
|
130
130
|
*/
|
|
@@ -133,10 +133,10 @@ export class ChangeApiConfig {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
|
-
* Instructs the
|
|
137
|
-
* used by their
|
|
138
|
-
* and set an HTTP request header for any subsequent
|
|
139
|
-
* issued via
|
|
136
|
+
* Instructs the [actor](https://serenity-js.org/api/core/class/Actor/) to change the configuration of the [`AxiosInstance`](https://axios-http.com/docs/instance)
|
|
137
|
+
* used by their [ability](https://serenity-js.org/api/core/class/Ability/) to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
138
|
+
* and set an HTTP request header for any subsequent [HTTP requests](https://serenity-js.org/api/rest/class/HTTPRequest/)
|
|
139
|
+
* issued via [`Send`](https://serenity-js.org/api/rest/class/Send/).
|
|
140
140
|
*
|
|
141
141
|
* @param name
|
|
142
142
|
* @param value
|