Skip to content

Commit c41a216

Browse files
alan-agius4AndrewKushnir
authored andcommitted
refactor(common): remove deprecated XhrFactory export from http entrypoint (#49251)
The deprecated `XhrFactory` export from `@angular/common/http` has been removed. BREAKING CHANGE: Deprecated `XhrFactory` export from `@angular/common/http` has been removed. Use `XhrFactory` from `@angular/common` instead. PR Close #49251
1 parent 17abe6d commit c41a216

File tree

3 files changed

+4
-43
lines changed

3 files changed

+4
-43
lines changed

aio/content/guide/deprecations.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ v15 - v18
7373

7474
| Area | API or Feature | Deprecated in | May be removed in |
7575
|:--- |:--- |:--- |:--- |
76-
| `@angular/common/http` | [`XhrFactory`](api/common/http/XhrFactory) | v12 | v15 |
7776
| `@angular/compiler-cli` | [Input setter coercion](#input-setter-coercion) | v13 | v15 |
7877
| `@angular/compiler-cli` | [`fullTemplateTypeCheck`](#full-template-type-check) | v13 | v15 |
7978
| `@angular/core` | [Factory-based signature of `ApplicationRef.bootstrap`](#core) | v13 | v15 |
@@ -145,14 +144,6 @@ In the [API reference section](api) of this site, deprecated APIs are indicated
145144
| [`NgComponentOutlet.ngComponentOutletNgModuleFactory`](api/common/NgComponentOutlet) | `NgComponentOutlet.ngComponentOutletNgModule` | v14 | Use the `ngComponentOutletNgModule` input instead. This input doesn't require resolving NgModule factory. |
146145
| [`DatePipe` - `DATE_PIPE_DEFAULT_TIMEZONE`](api/common/DATE_PIPE_DEFAULT_TIMEZONE) |`{ provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: { timezone: '-1200' }` | v15 | Use the `DATE_PIPE_DEFAULT_OPTIONS` injection token, which can configure multiple settings at once instead. |
147146

148-
<a id="common-http"></a>
149-
150-
### &commat;angular/common/http
151-
152-
| API | Replacement | Deprecation announced | Details |
153-
|:--- |:--- |:--- |:--- |
154-
| [`XhrFactory`](api/common/http/XhrFactory) | `XhrFactory` in `@angular/common` | v12 | The `XhrFactory` has moved from `@angular/common/http` to `@angular/common`. |
155-
156147
<a id="core"></a>
157148

158149
### &commat;angular/core

goldens/public-api/common/http/index.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { InjectionToken } from '@angular/core';
1111
import { ModuleWithProviders } from '@angular/core';
1212
import { Observable } from 'rxjs';
1313
import { Provider } from '@angular/core';
14-
import { XhrFactory as XhrFactory_2 } from '@angular/common';
14+
import { XhrFactory } from '@angular/common';
1515

1616
// @public
1717
export const HTTP_INTERCEPTORS: InjectionToken<HttpInterceptor[]>;
@@ -2129,7 +2129,7 @@ export interface HttpUserEvent<T> {
21292129

21302130
// @public
21312131
export class HttpXhrBackend implements HttpBackend {
2132-
constructor(xhrFactory: XhrFactory_2);
2132+
constructor(xhrFactory: XhrFactory);
21332133
handle(req: HttpRequest<any>): Observable<HttpEvent<any>>;
21342134
// (undocumented)
21352135
static ɵfac: i0.ɵɵFactoryDeclaration<HttpXhrBackend, never>;
@@ -2186,12 +2186,6 @@ export function withXsrfConfiguration({ cookieName, headerName }: {
21862186
headerName?: string;
21872187
}): HttpFeature<HttpFeatureKind.CustomXsrfConfiguration>;
21882188

2189-
// @public @deprecated
2190-
export type XhrFactory = XhrFactory_2;
2191-
2192-
// @public @deprecated
2193-
export const XhrFactory: typeof XhrFactory_2;
2194-
21952189
// (No @packageDocumentation comment for this package)
21962190

21972191
```

packages/common/http/public_api.ts

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,16 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {XhrFactory as XhrFactory_fromAngularCommon} from '@angular/common';
10-
11-
/**
12-
* A wrapper around the `XMLHttpRequest` constructor.
13-
*
14-
* @publicApi
15-
* @see `XhrFactory`
16-
* @deprecated
17-
* `XhrFactory` has moved, please import `XhrFactory` from `@angular/common` instead.
18-
*/
19-
export type XhrFactory = XhrFactory_fromAngularCommon;
20-
/**
21-
* A wrapper around the `XMLHttpRequest` constructor.
22-
*
23-
* @publicApi
24-
* @see `XhrFactory`
25-
* @deprecated
26-
* `XhrFactory` has moved, please import `XhrFactory` from `@angular/common` instead.
27-
*/
28-
export const XhrFactory = XhrFactory_fromAngularCommon;
29-
309
export {HttpBackend, HttpHandler} from './src/backend';
3110
export {HttpClient} from './src/client';
3211
export {HttpContext, HttpContextToken} from './src/context';
3312
export {HttpHeaders} from './src/headers';
34-
export {HTTP_INTERCEPTORS, HttpInterceptor, HttpInterceptorHandler as ɵHttpInterceptorHandler, HttpInterceptorFn, HttpHandlerFn} from './src/interceptor';
13+
export {HTTP_INTERCEPTORS, HttpHandlerFn, HttpInterceptor, HttpInterceptorFn, HttpInterceptorHandler as ɵHttpInterceptorHandler, HttpInterceptorHandler as ɵHttpInterceptingHandler} from './src/interceptor';
3514
export {JsonpClientBackend, JsonpInterceptor} from './src/jsonp';
3615
export {HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule} from './src/module';
3716
export {HttpParameterCodec, HttpParams, HttpParamsOptions, HttpUrlEncodingCodec} from './src/params';
38-
export {HttpFeature, HttpFeatureKind, provideHttpClient, withJsonpSupport, withNoXsrfProtection, withXsrfConfiguration, withInterceptors, withInterceptorsFromDi, withRequestsMadeViaParent} from './src/provider';
17+
export {HttpFeature, HttpFeatureKind, provideHttpClient, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXsrfConfiguration} from './src/provider';
3918
export {HttpRequest} from './src/request';
4019
export {HttpDownloadProgressEvent, HttpErrorResponse, HttpEvent, HttpEventType, HttpHeaderResponse, HttpProgressEvent, HttpResponse, HttpResponseBase, HttpSentEvent, HttpStatusCode, HttpUploadProgressEvent, HttpUserEvent} from './src/response';
4120
export {HttpXhrBackend} from './src/xhr';
4221
export {HttpXsrfTokenExtractor} from './src/xsrf';
43-
44-
// This re-export exists because g3 depends on this old private name.
45-
export {HttpInterceptorHandler as ɵHttpInterceptingHandler} from './src/interceptor';

0 commit comments

Comments
 (0)