feat: deprecate @angular/http in favor of @angular/common/http (#18906)

As of 5.0, @angular/http is deprecated. @angular/common/http will
be the official HTTP API in Angular going forward.

PR Close #18906
This commit is contained in:
Alex Rickabaugh
2017-08-28 10:29:35 -07:00
committed by Miško Hevery
parent 1ef558b57c
commit 72c7b6edea
34 changed files with 136 additions and 136 deletions

View File

@ -13,7 +13,7 @@ import {Injectable} from '@angular/core';
*
* Take care not to evaluate this in non-browser contexts.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
@Injectable()
export class BrowserXhr {

View File

@ -24,7 +24,7 @@ const JSONP_ERR_WRONG_METHOD = 'JSONP requests must use GET request method.';
/**
* Abstract base class for an in-flight JSONP request.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export abstract class JSONPConnection implements Connection {
/**
@ -141,7 +141,7 @@ export class JSONPConnection_ extends JSONPConnection {
/**
* A {@link ConnectionBackend} that uses the JSONP strategy of making requests.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export abstract class JSONPBackend extends ConnectionBackend {}

View File

@ -29,7 +29,7 @@ const XSSI_PREFIX = /^\)\]\}',?\n/;
* This class would typically not be created or interacted with directly inside applications, though
* the {@link MockConnection} may be interacted with in tests.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export class XHRConnection implements Connection {
request: Request;
@ -188,7 +188,7 @@ export class XHRConnection implements Connection {
* with different `cookieName` and `headerName` values. See the main HTTP documentation for more
* details.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export class CookieXSRFStrategy implements XSRFStrategy {
constructor(
@ -226,7 +226,7 @@ export class CookieXSRFStrategy implements XSRFStrategy {
* }
* }
* ```
* @experimental
* @deprecated use @angular/common/http instead
*/
@Injectable()
export class XHRBackend implements ConnectionBackend {

View File

@ -37,7 +37,7 @@ import {URLSearchParams} from './url_search_params';
* console.log('options.url:', options.url); // https://google.com
* ```
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export class RequestOptions {
/**
@ -200,7 +200,7 @@ export class RequestOptions {
* console.log('req.url:', req.url); // https://google.com
* ```
*
* @experimental
* @deprecated use @angular/common/http instead
*/
@Injectable()
export class BaseRequestOptions extends RequestOptions {

View File

@ -39,7 +39,7 @@ import {ResponseOptionsArgs} from './interfaces';
* console.log('res.json():', res.json()); // Object {name: "Jeff"}
* ```
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export class ResponseOptions {
// TODO: FormData | Blob
@ -156,7 +156,7 @@ export class ResponseOptions {
* console.log('res.text():', res.text()); // Angular;
* ```
*
* @experimental
* @deprecated use @angular/common/http instead
*/
@Injectable()
export class BaseResponseOptions extends ResponseOptions {

View File

@ -8,7 +8,7 @@
/**
* Supported http methods.
* @experimental
* @deprecated use @angular/common/http instead
*/
export enum RequestMethod {
Get,
@ -24,7 +24,7 @@ export enum RequestMethod {
* All possible states in which a connection can be, based on
* [States](http://www.w3.org/TR/XMLHttpRequest/#states) from the `XMLHttpRequest` spec, but with an
* additional "CANCELLED" state.
* @experimental
* @deprecated use @angular/common/http instead
*/
export enum ReadyState {
Unsent,
@ -38,7 +38,7 @@ export enum ReadyState {
/**
* Acceptable response types to be associated with a {@link Response}, based on
* [ResponseType](https://fetch.spec.whatwg.org/#responsetype) from the Fetch spec.
* @experimental
* @deprecated use @angular/common/http instead
*/
export enum ResponseType {
Basic,
@ -50,7 +50,7 @@ export enum ResponseType {
/**
* Supported content type to be automatically associated with a {@link Request}.
* @experimental
* @deprecated use @angular/common/http instead
*/
export enum ContentType {
NONE,
@ -64,7 +64,7 @@ export enum ContentType {
/**
* Define which buffer to use to store the response
* @experimental
* @deprecated use @angular/common/http instead
*/
export enum ResponseContentType {
Text,

View File

@ -32,7 +32,7 @@
* console.log(thirdHeaders.get('X-My-Custom-Header')); //'Angular'
* ```
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export class Headers {
/** @internal header names are lower case */

View File

@ -98,7 +98,7 @@ function mergeOptions(
* http.get('request-from-mock-backend.json').subscribe((res:Response) => doSomething(res));
* ```
*
* @experimental
* @deprecated use @angular/common/http instead
*/
@Injectable()
export class Http {
@ -186,7 +186,7 @@ export class Http {
/**
* @experimental
* @deprecated use @angular/common/http instead
*/
@Injectable()
export class Jsonp extends Http {

View File

@ -40,7 +40,7 @@ export function jsonpFactory(jsonpBackend: JSONPBackend, requestOptions: Request
/**
* The module that includes http's providers
*
* @experimental
* @deprecated use @angular/common/http instead
*/
@NgModule({
providers: [
@ -60,7 +60,7 @@ export class HttpModule {
/**
* The module that includes jsonp's providers
*
* @experimental
* @deprecated use @angular/common/http instead
*/
@NgModule({
providers: [

View File

@ -17,14 +17,14 @@ import {URLSearchParams} from './url_search_params';
* The primary purpose of a `ConnectionBackend` is to create new connections to fulfill a given
* {@link Request}.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export abstract class ConnectionBackend { abstract createConnection(request: any): Connection; }
/**
* Abstract class from which real connections are derived.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export abstract class Connection {
readyState: ReadyState;
@ -35,7 +35,7 @@ export abstract class Connection {
/**
* An XSRFStrategy configures XSRF protection (e.g. via headers) on an HTTP request.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export abstract class XSRFStrategy { abstract configureRequest(req: Request): void; }
@ -43,7 +43,7 @@ export abstract class XSRFStrategy { abstract configureRequest(req: Request): vo
* Interface for options to construct a RequestOptions, based on
* [RequestInit](https://fetch.spec.whatwg.org/#requestinit) from the Fetch spec.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export interface RequestOptionsArgs {
url?: string|null;
@ -66,7 +66,7 @@ export interface RequestArgs extends RequestOptionsArgs { url: string|null; }
* Interface for options to construct a Response, based on
* [ResponseInit](https://fetch.spec.whatwg.org/#responseinit) from the Fetch spec.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export interface ResponseOptionsArgs {
body?: string|Object|FormData|ArrayBuffer|Blob|null;

View File

@ -52,7 +52,7 @@ import {URLSearchParams} from './url_search_params';
* });
* ```
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export class Request extends Body {
/**

View File

@ -32,7 +32,7 @@ import {Headers} from './headers';
* can be accessed many times. There are other differences in the implementation, but this is the
* most significant.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export class Response extends Body {
/**

View File

@ -22,7 +22,7 @@ function paramParser(rawParams: string = ''): Map<string, string[]> {
return map;
}
/**
* @experimental
* @deprecated use @angular/common/http instead
**/
export class QueryEncoder {
encodeKey(k: string): string { return standardEncoding(k); }
@ -76,7 +76,7 @@ function standardEncoding(v: string): string {
*
* let params = new URLSearchParams('', new MyQueryEncoder());
* ```
* @experimental
* @deprecated use @angular/common/http instead
*/
export class URLSearchParams {
paramsMap: Map<string, string[]>;

View File

@ -14,6 +14,6 @@
import {Version} from '@angular/core';
/**
* @stable
* @deprecated use @angular/common/http instead
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');

View File

@ -17,7 +17,7 @@ import {take} from 'rxjs/operator/take';
*
* Mock Connection to represent a {@link Connection} for tests.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
export class MockConnection implements Connection {
// TODO Name `readyState` should change to be more generic, and states could be made to be more
@ -190,7 +190,7 @@ export class MockConnection implements Connection {
*
* This method only exists in the mock implementation, not in real Backends.
*
* @experimental
* @deprecated use @angular/common/http instead
*/
@Injectable()
export class MockBackend implements ConnectionBackend {