@angular/common 21.0.0-next.9 → 21.0.0-rc.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/fesm2022/_common_module-chunk.mjs +3050 -4380
- package/fesm2022/_common_module-chunk.mjs.map +1 -1
- package/fesm2022/_location-chunk.mjs +392 -588
- package/fesm2022/_location-chunk.mjs.map +1 -1
- package/fesm2022/_module-chunk.mjs +2042 -3001
- package/fesm2022/_module-chunk.mjs.map +1 -1
- package/fesm2022/_platform_navigation-chunk.mjs +30 -16
- package/fesm2022/_platform_navigation-chunk.mjs.map +1 -1
- package/fesm2022/_xhr-chunk.mjs +10 -16
- package/fesm2022/_xhr-chunk.mjs.map +1 -1
- package/fesm2022/common.mjs +1135 -1837
- package/fesm2022/common.mjs.map +1 -1
- package/fesm2022/http-testing.mjs +259 -310
- package/fesm2022/http-testing.mjs.map +1 -1
- package/fesm2022/http.mjs +302 -370
- package/fesm2022/http.mjs.map +1 -1
- package/fesm2022/testing.mjs +596 -552
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/upgrade.mjs +601 -838
- package/fesm2022/upgrade.mjs.map +1 -1
- package/package.json +2 -2
- package/types/_common_module-chunk.d.ts +1 -1
- package/types/_module-chunk.d.ts +33 -1
- package/types/_platform_location-chunk.d.ts +1 -1
- package/types/_xhr-chunk.d.ts +1 -1
- package/types/common.d.ts +34 -4
- package/types/http-testing.d.ts +1 -1
- package/types/http.d.ts +13 -2
- package/types/testing.d.ts +88 -62
- package/types/upgrade.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.0.0-
|
|
2
|
+
* @license Angular v21.0.0-rc.0
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -11,351 +11,300 @@ import { HttpHeaders, HttpResponse, HttpErrorResponse, HttpStatusCode, HttpEvent
|
|
|
11
11
|
import 'rxjs/operators';
|
|
12
12
|
import './_xhr-chunk.mjs';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
* Controller to be injected into tests, that allows for mocking and flushing
|
|
16
|
-
* of requests.
|
|
17
|
-
*
|
|
18
|
-
* @publicApi
|
|
19
|
-
*/
|
|
20
|
-
class HttpTestingController {
|
|
21
|
-
}
|
|
14
|
+
class HttpTestingController {}
|
|
22
15
|
|
|
23
|
-
/**
|
|
24
|
-
* A mock requests that was received and is ready to be answered.
|
|
25
|
-
*
|
|
26
|
-
* This interface allows access to the underlying `HttpRequest`, and allows
|
|
27
|
-
* responding with `HttpEvent`s or `HttpErrorResponse`s.
|
|
28
|
-
*
|
|
29
|
-
* @publicApi
|
|
30
|
-
*/
|
|
31
16
|
class TestRequest {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
request;
|
|
18
|
+
observer;
|
|
19
|
+
get cancelled() {
|
|
20
|
+
return this._cancelled;
|
|
21
|
+
}
|
|
22
|
+
_cancelled = false;
|
|
23
|
+
constructor(request, observer) {
|
|
24
|
+
this.request = request;
|
|
25
|
+
this.observer = observer;
|
|
26
|
+
}
|
|
27
|
+
flush(body, opts = {}) {
|
|
28
|
+
if (this.cancelled) {
|
|
29
|
+
throw new Error(`Cannot flush a cancelled request.`);
|
|
39
30
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
const url = this.request.urlWithParams;
|
|
32
|
+
const headers = opts.headers instanceof HttpHeaders ? opts.headers : new HttpHeaders(opts.headers);
|
|
33
|
+
body = _maybeConvertBody(this.request.responseType, body);
|
|
34
|
+
let statusText = opts.statusText;
|
|
35
|
+
let status = opts.status !== undefined ? opts.status : HttpStatusCode.Ok;
|
|
36
|
+
if (opts.status === undefined) {
|
|
37
|
+
if (body === null) {
|
|
38
|
+
status = HttpStatusCode.NoContent;
|
|
39
|
+
statusText ||= 'No Content';
|
|
40
|
+
} else {
|
|
41
|
+
statusText ||= 'OK';
|
|
42
|
+
}
|
|
47
43
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* headers) if provided.
|
|
51
|
-
* If the request specifies an expected body type, the body is converted into the requested type.
|
|
52
|
-
* Otherwise, the body is converted to `JSON` by default.
|
|
53
|
-
*
|
|
54
|
-
* Both successful and unsuccessful responses can be delivered via `flush()`.
|
|
55
|
-
*/
|
|
56
|
-
flush(body, opts = {}) {
|
|
57
|
-
if (this.cancelled) {
|
|
58
|
-
throw new Error(`Cannot flush a cancelled request.`);
|
|
59
|
-
}
|
|
60
|
-
const url = this.request.urlWithParams;
|
|
61
|
-
const headers = opts.headers instanceof HttpHeaders ? opts.headers : new HttpHeaders(opts.headers);
|
|
62
|
-
body = _maybeConvertBody(this.request.responseType, body);
|
|
63
|
-
let statusText = opts.statusText;
|
|
64
|
-
let status = opts.status !== undefined ? opts.status : HttpStatusCode.Ok;
|
|
65
|
-
if (opts.status === undefined) {
|
|
66
|
-
if (body === null) {
|
|
67
|
-
status = HttpStatusCode.NoContent;
|
|
68
|
-
statusText ||= 'No Content';
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
statusText ||= 'OK';
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (statusText === undefined) {
|
|
75
|
-
throw new Error('statusText is required when setting a custom status.');
|
|
76
|
-
}
|
|
77
|
-
if (status >= 200 && status < 300) {
|
|
78
|
-
this.observer.next(new HttpResponse({ body, headers, status, statusText, url }));
|
|
79
|
-
this.observer.complete();
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
this.observer.error(new HttpErrorResponse({ error: body, headers, status, statusText, url }));
|
|
83
|
-
}
|
|
44
|
+
if (statusText === undefined) {
|
|
45
|
+
throw new Error('statusText is required when setting a custom status.');
|
|
84
46
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
47
|
+
if (status >= 200 && status < 300) {
|
|
48
|
+
this.observer.next(new HttpResponse({
|
|
49
|
+
body,
|
|
50
|
+
headers,
|
|
51
|
+
status,
|
|
52
|
+
statusText,
|
|
53
|
+
url
|
|
54
|
+
}));
|
|
55
|
+
this.observer.complete();
|
|
56
|
+
} else {
|
|
57
|
+
this.observer.error(new HttpErrorResponse({
|
|
58
|
+
error: body,
|
|
59
|
+
headers,
|
|
60
|
+
status,
|
|
61
|
+
statusText,
|
|
62
|
+
url
|
|
63
|
+
}));
|
|
97
64
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
event(event) {
|
|
103
|
-
if (this.cancelled) {
|
|
104
|
-
throw new Error(`Cannot send events to a cancelled request.`);
|
|
105
|
-
}
|
|
106
|
-
this.observer.next(event);
|
|
65
|
+
}
|
|
66
|
+
error(error, opts = {}) {
|
|
67
|
+
if (this.cancelled) {
|
|
68
|
+
throw new Error(`Cannot return an error for a cancelled request.`);
|
|
107
69
|
}
|
|
70
|
+
const headers = opts.headers instanceof HttpHeaders ? opts.headers : new HttpHeaders(opts.headers);
|
|
71
|
+
this.observer.error(new HttpErrorResponse({
|
|
72
|
+
error,
|
|
73
|
+
headers,
|
|
74
|
+
status: opts.status || 0,
|
|
75
|
+
statusText: opts.statusText || '',
|
|
76
|
+
url: this.request.urlWithParams
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
event(event) {
|
|
80
|
+
if (this.cancelled) {
|
|
81
|
+
throw new Error(`Cannot send events to a cancelled request.`);
|
|
82
|
+
}
|
|
83
|
+
this.observer.next(event);
|
|
84
|
+
}
|
|
108
85
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Helper function to convert a response body to an ArrayBuffer.
|
|
111
|
-
*/
|
|
112
86
|
function _toArrayBufferBody(body) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
87
|
+
if (typeof ArrayBuffer === 'undefined') {
|
|
88
|
+
throw new Error('ArrayBuffer responses are not supported on this platform.');
|
|
89
|
+
}
|
|
90
|
+
if (body instanceof ArrayBuffer) {
|
|
91
|
+
return body;
|
|
92
|
+
}
|
|
93
|
+
throw new Error('Automatic conversion to ArrayBuffer is not supported for response type.');
|
|
120
94
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Helper function to convert a response body to a Blob.
|
|
123
|
-
*/
|
|
124
95
|
function _toBlob(body) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
96
|
+
if (typeof Blob === 'undefined') {
|
|
97
|
+
throw new Error('Blob responses are not supported on this platform.');
|
|
98
|
+
}
|
|
99
|
+
if (body instanceof Blob) {
|
|
100
|
+
return body;
|
|
101
|
+
}
|
|
102
|
+
if (ArrayBuffer && body instanceof ArrayBuffer) {
|
|
103
|
+
return new Blob([body]);
|
|
104
|
+
}
|
|
105
|
+
throw new Error('Automatic conversion to Blob is not supported for response type.');
|
|
135
106
|
}
|
|
136
|
-
/**
|
|
137
|
-
* Helper function to convert a response body to JSON data.
|
|
138
|
-
*/
|
|
139
107
|
function _toJsonBody(body, format = 'JSON') {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
Array.isArray(body)) {
|
|
151
|
-
return body;
|
|
152
|
-
}
|
|
153
|
-
throw new Error(`Automatic conversion to ${format} is not supported for response type.`);
|
|
108
|
+
if (typeof ArrayBuffer !== 'undefined' && body instanceof ArrayBuffer) {
|
|
109
|
+
throw new Error(`Automatic conversion to ${format} is not supported for ArrayBuffers.`);
|
|
110
|
+
}
|
|
111
|
+
if (typeof Blob !== 'undefined' && body instanceof Blob) {
|
|
112
|
+
throw new Error(`Automatic conversion to ${format} is not supported for Blobs.`);
|
|
113
|
+
}
|
|
114
|
+
if (typeof body === 'string' || typeof body === 'number' || typeof body === 'object' || typeof body === 'boolean' || Array.isArray(body)) {
|
|
115
|
+
return body;
|
|
116
|
+
}
|
|
117
|
+
throw new Error(`Automatic conversion to ${format} is not supported for response type.`);
|
|
154
118
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Helper function to convert a response body to a string.
|
|
157
|
-
*/
|
|
158
119
|
function _toTextBody(body) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
120
|
+
if (typeof body === 'string') {
|
|
121
|
+
return body;
|
|
122
|
+
}
|
|
123
|
+
if (typeof ArrayBuffer !== 'undefined' && body instanceof ArrayBuffer) {
|
|
124
|
+
throw new Error('Automatic conversion to text is not supported for ArrayBuffers.');
|
|
125
|
+
}
|
|
126
|
+
if (typeof Blob !== 'undefined' && body instanceof Blob) {
|
|
127
|
+
throw new Error('Automatic conversion to text is not supported for Blobs.');
|
|
128
|
+
}
|
|
129
|
+
return JSON.stringify(_toJsonBody(body, 'text'));
|
|
169
130
|
}
|
|
170
|
-
/**
|
|
171
|
-
* Convert a response body to the requested type.
|
|
172
|
-
*/
|
|
173
131
|
function _maybeConvertBody(responseType, body) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
132
|
+
if (body === null) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
switch (responseType) {
|
|
136
|
+
case 'arraybuffer':
|
|
137
|
+
return _toArrayBufferBody(body);
|
|
138
|
+
case 'blob':
|
|
139
|
+
return _toBlob(body);
|
|
140
|
+
case 'json':
|
|
141
|
+
return _toJsonBody(body);
|
|
142
|
+
case 'text':
|
|
143
|
+
return _toTextBody(body);
|
|
144
|
+
default:
|
|
145
|
+
throw new Error(`Unsupported responseType: ${responseType}`);
|
|
146
|
+
}
|
|
189
147
|
}
|
|
190
148
|
|
|
191
|
-
/**
|
|
192
|
-
* A testing backend for `HttpClient` which both acts as an `HttpBackend`
|
|
193
|
-
* and as the `HttpTestingController`.
|
|
194
|
-
*
|
|
195
|
-
* `HttpClientTestingBackend` works by keeping a list of all open requests.
|
|
196
|
-
* As requests come in, they're added to the list. Users can assert that specific
|
|
197
|
-
* requests were made and then flush them. In the end, a verify() method asserts
|
|
198
|
-
* that no unexpected requests were made.
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*/
|
|
202
149
|
class HttpClientTestingBackend {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
150
|
+
open = [];
|
|
151
|
+
isTestingBackend = true;
|
|
152
|
+
handle(req) {
|
|
153
|
+
return new Observable(observer => {
|
|
154
|
+
const testReq = new TestRequest(req, observer);
|
|
155
|
+
this.open.push(testReq);
|
|
156
|
+
observer.next({
|
|
157
|
+
type: HttpEventType.Sent
|
|
158
|
+
});
|
|
159
|
+
return () => {
|
|
160
|
+
testReq._cancelled = true;
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
_match(match) {
|
|
165
|
+
if (typeof match === 'string') {
|
|
166
|
+
return this.open.filter(testReq => testReq.request.urlWithParams === match);
|
|
167
|
+
} else if (typeof match === 'function') {
|
|
168
|
+
return this.open.filter(testReq => match(testReq.request));
|
|
169
|
+
} else {
|
|
170
|
+
return this.open.filter(testReq => (!match.method || testReq.request.method === match.method.toUpperCase()) && (!match.url || testReq.request.urlWithParams === match.url));
|
|
223
171
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
172
|
+
}
|
|
173
|
+
match(match) {
|
|
174
|
+
const results = this._match(match);
|
|
175
|
+
results.forEach(result => {
|
|
176
|
+
const index = this.open.indexOf(result);
|
|
177
|
+
if (index !== -1) {
|
|
178
|
+
this.open.splice(index, 1);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return results;
|
|
182
|
+
}
|
|
183
|
+
expectOne(match, description) {
|
|
184
|
+
description ||= this.descriptionFromMatcher(match);
|
|
185
|
+
const matches = this.match(match);
|
|
186
|
+
if (matches.length > 1) {
|
|
187
|
+
throw new Error(`Expected one matching request for criteria "${description}", found ${matches.length} requests.`);
|
|
238
188
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const index = this.open.indexOf(result);
|
|
247
|
-
if (index !== -1) {
|
|
248
|
-
this.open.splice(index, 1);
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
return results;
|
|
189
|
+
if (matches.length === 0) {
|
|
190
|
+
let message = `Expected one matching request for criteria "${description}", found none.`;
|
|
191
|
+
if (this.open.length > 0) {
|
|
192
|
+
const requests = this.open.map(describeRequest).join(', ');
|
|
193
|
+
message += ` Requests received are: ${requests}.`;
|
|
194
|
+
}
|
|
195
|
+
throw new Error(message);
|
|
252
196
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
expectOne(match, description) {
|
|
261
|
-
description ||= this.descriptionFromMatcher(match);
|
|
262
|
-
const matches = this.match(match);
|
|
263
|
-
if (matches.length > 1) {
|
|
264
|
-
throw new Error(`Expected one matching request for criteria "${description}", found ${matches.length} requests.`);
|
|
265
|
-
}
|
|
266
|
-
if (matches.length === 0) {
|
|
267
|
-
let message = `Expected one matching request for criteria "${description}", found none.`;
|
|
268
|
-
if (this.open.length > 0) {
|
|
269
|
-
// Show the methods and URLs of open requests in the error, for convenience.
|
|
270
|
-
const requests = this.open.map(describeRequest).join(', ');
|
|
271
|
-
message += ` Requests received are: ${requests}.`;
|
|
272
|
-
}
|
|
273
|
-
throw new Error(message);
|
|
274
|
-
}
|
|
275
|
-
return matches[0];
|
|
197
|
+
return matches[0];
|
|
198
|
+
}
|
|
199
|
+
expectNone(match, description) {
|
|
200
|
+
description ||= this.descriptionFromMatcher(match);
|
|
201
|
+
const matches = this.match(match);
|
|
202
|
+
if (matches.length > 0) {
|
|
203
|
+
throw new Error(`Expected zero matching requests for criteria "${description}", found ${matches.length}.`);
|
|
276
204
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
description ||= this.descriptionFromMatcher(match);
|
|
283
|
-
const matches = this.match(match);
|
|
284
|
-
if (matches.length > 0) {
|
|
285
|
-
throw new Error(`Expected zero matching requests for criteria "${description}", found ${matches.length}.`);
|
|
286
|
-
}
|
|
205
|
+
}
|
|
206
|
+
verify(opts = {}) {
|
|
207
|
+
let open = this.open;
|
|
208
|
+
if (opts.ignoreCancelled) {
|
|
209
|
+
open = open.filter(testReq => !testReq.cancelled);
|
|
287
210
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
verify(opts = {}) {
|
|
292
|
-
let open = this.open;
|
|
293
|
-
// It's possible that some requests may be cancelled, and this is expected.
|
|
294
|
-
// The user can ask to ignore open requests which have been cancelled.
|
|
295
|
-
if (opts.ignoreCancelled) {
|
|
296
|
-
open = open.filter((testReq) => !testReq.cancelled);
|
|
297
|
-
}
|
|
298
|
-
if (open.length > 0) {
|
|
299
|
-
// Show the methods and URLs of open requests in the error, for convenience.
|
|
300
|
-
const requests = open.map(describeRequest).join(', ');
|
|
301
|
-
throw new Error(`Expected no open requests, found ${open.length}: ${requests}`);
|
|
302
|
-
}
|
|
211
|
+
if (open.length > 0) {
|
|
212
|
+
const requests = open.map(describeRequest).join(', ');
|
|
213
|
+
throw new Error(`Expected no open requests, found ${open.length}: ${requests}`);
|
|
303
214
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
return `Match by function: ${matcher.name}`;
|
|
315
|
-
}
|
|
215
|
+
}
|
|
216
|
+
descriptionFromMatcher(matcher) {
|
|
217
|
+
if (typeof matcher === 'string') {
|
|
218
|
+
return `Match URL: ${matcher}`;
|
|
219
|
+
} else if (typeof matcher === 'object') {
|
|
220
|
+
const method = matcher.method || '(any)';
|
|
221
|
+
const url = matcher.url || '(any)';
|
|
222
|
+
return `Match method: ${method}, URL: ${url}`;
|
|
223
|
+
} else {
|
|
224
|
+
return `Match by function: ${matcher.name}`;
|
|
316
225
|
}
|
|
317
|
-
|
|
318
|
-
|
|
226
|
+
}
|
|
227
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
228
|
+
minVersion: "12.0.0",
|
|
229
|
+
version: "21.0.0-rc.0",
|
|
230
|
+
ngImport: i0,
|
|
231
|
+
type: HttpClientTestingBackend,
|
|
232
|
+
deps: [],
|
|
233
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
234
|
+
});
|
|
235
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
236
|
+
minVersion: "12.0.0",
|
|
237
|
+
version: "21.0.0-rc.0",
|
|
238
|
+
ngImport: i0,
|
|
239
|
+
type: HttpClientTestingBackend
|
|
240
|
+
});
|
|
319
241
|
}
|
|
320
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
321
|
-
|
|
322
|
-
|
|
242
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
243
|
+
minVersion: "12.0.0",
|
|
244
|
+
version: "21.0.0-rc.0",
|
|
245
|
+
ngImport: i0,
|
|
246
|
+
type: HttpClientTestingBackend,
|
|
247
|
+
decorators: [{
|
|
248
|
+
type: Injectable
|
|
249
|
+
}]
|
|
250
|
+
});
|
|
323
251
|
function describeRequest(testRequest) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
252
|
+
const url = testRequest.request.urlWithParams;
|
|
253
|
+
const method = testRequest.request.method;
|
|
254
|
+
return `${method} ${url}`;
|
|
327
255
|
}
|
|
328
256
|
|
|
329
257
|
function provideHttpClientTesting() {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
258
|
+
return [HttpClientTestingBackend, {
|
|
259
|
+
provide: HttpBackend,
|
|
260
|
+
useExisting: HttpClientTestingBackend
|
|
261
|
+
}, {
|
|
262
|
+
provide: HttpTestingController,
|
|
263
|
+
useExisting: HttpClientTestingBackend
|
|
264
|
+
}, {
|
|
265
|
+
provide: REQUESTS_CONTRIBUTE_TO_STABILITY,
|
|
266
|
+
useValue: false
|
|
267
|
+
}];
|
|
336
268
|
}
|
|
337
269
|
|
|
338
|
-
/**
|
|
339
|
-
* Configures `HttpClientTestingBackend` as the `HttpBackend` used by `HttpClient`.
|
|
340
|
-
*
|
|
341
|
-
* Inject `HttpTestingController` to expect and flush requests in your tests.
|
|
342
|
-
*
|
|
343
|
-
* @publicApi
|
|
344
|
-
*
|
|
345
|
-
* @deprecated Add `provideHttpClientTesting()` to your providers instead.
|
|
346
|
-
*/
|
|
347
270
|
class HttpClientTestingModule {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
271
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
272
|
+
minVersion: "12.0.0",
|
|
273
|
+
version: "21.0.0-rc.0",
|
|
274
|
+
ngImport: i0,
|
|
275
|
+
type: HttpClientTestingModule,
|
|
276
|
+
deps: [],
|
|
277
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
278
|
+
});
|
|
279
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
280
|
+
minVersion: "14.0.0",
|
|
281
|
+
version: "21.0.0-rc.0",
|
|
282
|
+
ngImport: i0,
|
|
283
|
+
type: HttpClientTestingModule,
|
|
284
|
+
imports: [HttpClientModule]
|
|
285
|
+
});
|
|
286
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
287
|
+
minVersion: "12.0.0",
|
|
288
|
+
version: "21.0.0-rc.0",
|
|
289
|
+
ngImport: i0,
|
|
290
|
+
type: HttpClientTestingModule,
|
|
291
|
+
providers: [provideHttpClientTesting()],
|
|
292
|
+
imports: [HttpClientModule]
|
|
293
|
+
});
|
|
351
294
|
}
|
|
352
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
295
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
296
|
+
minVersion: "12.0.0",
|
|
297
|
+
version: "21.0.0-rc.0",
|
|
298
|
+
ngImport: i0,
|
|
299
|
+
type: HttpClientTestingModule,
|
|
300
|
+
decorators: [{
|
|
301
|
+
type: NgModule,
|
|
302
|
+
args: [{
|
|
303
|
+
imports: [HttpClientModule],
|
|
304
|
+
providers: [provideHttpClientTesting()]
|
|
305
|
+
}]
|
|
306
|
+
}]
|
|
307
|
+
});
|
|
359
308
|
|
|
360
309
|
export { HttpClientTestingModule, HttpTestingController, TestRequest, provideHttpClientTesting };
|
|
361
310
|
//# sourceMappingURL=http-testing.mjs.map
|