Skip to content

Commit

Permalink
refactor(common): remove deprecated XhrFactory export from http e…
Browse files Browse the repository at this point in the history
…ntrypoint (#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
  • Loading branch information
alan-agius4 authored and AndrewKushnir committed Mar 1, 2023
1 parent 17abe6d commit c41a216
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 43 deletions.
9 changes: 0 additions & 9 deletions aio/content/guide/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ v15 - v18

| Area | API or Feature | Deprecated in | May be removed in |
|:--- |:--- |:--- |:--- |
| `@angular/common/http` | [`XhrFactory`](api/common/http/XhrFactory) | v12 | v15 |
| `@angular/compiler-cli` | [Input setter coercion](#input-setter-coercion) | v13 | v15 |
| `@angular/compiler-cli` | [`fullTemplateTypeCheck`](#full-template-type-check) | v13 | v15 |
| `@angular/core` | [Factory-based signature of `ApplicationRef.bootstrap`](#core) | v13 | v15 |
Expand Down Expand Up @@ -145,14 +144,6 @@ In the [API reference section](api) of this site, deprecated APIs are indicated
| [`NgComponentOutlet.ngComponentOutletNgModuleFactory`](api/common/NgComponentOutlet) | `NgComponentOutlet.ngComponentOutletNgModule` | v14 | Use the `ngComponentOutletNgModule` input instead. This input doesn't require resolving NgModule factory. |
| [`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. |

<a id="common-http"></a>

### &commat;angular/common/http

| API | Replacement | Deprecation announced | Details |
|:--- |:--- |:--- |:--- |
| [`XhrFactory`](api/common/http/XhrFactory) | `XhrFactory` in `@angular/common` | v12 | The `XhrFactory` has moved from `@angular/common/http` to `@angular/common`. |

<a id="core"></a>

### &commat;angular/core
Expand Down
10 changes: 2 additions & 8 deletions goldens/public-api/common/http/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { InjectionToken } from '@angular/core';
import { ModuleWithProviders } from '@angular/core';
import { Observable } from 'rxjs';
import { Provider } from '@angular/core';
import { XhrFactory as XhrFactory_2 } from '@angular/common';
import { XhrFactory } from '@angular/common';

// @public
export const HTTP_INTERCEPTORS: InjectionToken<HttpInterceptor[]>;
Expand Down Expand Up @@ -2129,7 +2129,7 @@ export interface HttpUserEvent<T> {

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

// @public @deprecated
export type XhrFactory = XhrFactory_2;

// @public @deprecated
export const XhrFactory: typeof XhrFactory_2;

// (No @packageDocumentation comment for this package)

```
28 changes: 2 additions & 26 deletions packages/common/http/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,16 @@
* found in the LICENSE file at https://angular.io/license
*/

import {XhrFactory as XhrFactory_fromAngularCommon} from '@angular/common';

/**
* A wrapper around the `XMLHttpRequest` constructor.
*
* @publicApi
* @see `XhrFactory`
* @deprecated
* `XhrFactory` has moved, please import `XhrFactory` from `@angular/common` instead.
*/
export type XhrFactory = XhrFactory_fromAngularCommon;
/**
* A wrapper around the `XMLHttpRequest` constructor.
*
* @publicApi
* @see `XhrFactory`
* @deprecated
* `XhrFactory` has moved, please import `XhrFactory` from `@angular/common` instead.
*/
export const XhrFactory = XhrFactory_fromAngularCommon;

export {HttpBackend, HttpHandler} from './src/backend';
export {HttpClient} from './src/client';
export {HttpContext, HttpContextToken} from './src/context';
export {HttpHeaders} from './src/headers';
export {HTTP_INTERCEPTORS, HttpInterceptor, HttpInterceptorHandler as ɵHttpInterceptorHandler, HttpInterceptorFn, HttpHandlerFn} from './src/interceptor';
export {HTTP_INTERCEPTORS, HttpHandlerFn, HttpInterceptor, HttpInterceptorFn, HttpInterceptorHandler as ɵHttpInterceptorHandler, HttpInterceptorHandler as ɵHttpInterceptingHandler} from './src/interceptor';
export {JsonpClientBackend, JsonpInterceptor} from './src/jsonp';
export {HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule} from './src/module';
export {HttpParameterCodec, HttpParams, HttpParamsOptions, HttpUrlEncodingCodec} from './src/params';
export {HttpFeature, HttpFeatureKind, provideHttpClient, withJsonpSupport, withNoXsrfProtection, withXsrfConfiguration, withInterceptors, withInterceptorsFromDi, withRequestsMadeViaParent} from './src/provider';
export {HttpFeature, HttpFeatureKind, provideHttpClient, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXsrfConfiguration} from './src/provider';
export {HttpRequest} from './src/request';
export {HttpDownloadProgressEvent, HttpErrorResponse, HttpEvent, HttpEventType, HttpHeaderResponse, HttpProgressEvent, HttpResponse, HttpResponseBase, HttpSentEvent, HttpStatusCode, HttpUploadProgressEvent, HttpUserEvent} from './src/response';
export {HttpXhrBackend} from './src/xhr';
export {HttpXsrfTokenExtractor} from './src/xsrf';

// This re-export exists because g3 depends on this old private name.
export {HttpInterceptorHandler as ɵHttpInterceptingHandler} from './src/interceptor';

0 comments on commit c41a216

Please sign in to comment.