blob: af5b27dbc40b9403f4a5f8dcb430fda3a567dd20 [file] [log] [blame]
/**
* @license Angular v8.0.0-beta.10+1.sha-a28b3e3
* (c) 2010-2019 Google LLC. https://angular.io/
* License: MIT
*/
import { Observable } from 'rxjs';
import { Version } from '@angular/core';
/**
* Subclass of {@link RequestOptions}, with default values.
*
* Default values:
* * method: {@link RequestMethod RequestMethod.Get}
* * headers: empty {@link Headers} object
*
* This class could be extended and bound to the {@link RequestOptions} class
* when configuring an {@link Injector}, in order to override the default options
* used by {@link Http} to create and send {@link Request Requests}.
*
* ```typescript
* import {BaseRequestOptions, RequestOptions} from '@angular/http';
*
* class MyOptions extends BaseRequestOptions {
* search: string = 'coreTeam=true';
* }
*
* {provide: RequestOptions, useClass: MyOptions};
* ```
*
* The options could also be extended when manually creating a {@link Request}
* object.
*
* ```
* import {BaseRequestOptions, Request, RequestMethod} from '@angular/http';
*
* const options = new BaseRequestOptions();
* const req = new Request(options.merge({
* method: RequestMethod.Post,
* url: 'https://google.com'
* }));
* console.log('req.method:', RequestMethod[req.method]); // Post
* console.log('options.url:', options.url); // null
* console.log('req.url:', req.url); // https://google.com
* ```
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class BaseRequestOptions extends RequestOptions {
constructor();
}
/**
* Subclass of {@link ResponseOptions}, with default values.
*
* Default values:
* * status: 200
* * headers: empty {@link Headers} object
*
* This class could be extended and bound to the {@link ResponseOptions} class
* when configuring an {@link Injector}, in order to override the default options
* used by {@link Http} to create {@link Response Responses}.
*
* @usageNotes
* ### Example
*
* ```typescript
* import {provide} from '@angular/core';
* import {bootstrap} from '@angular/platform-browser/browser';
* import {HTTP_PROVIDERS, Headers, Http, BaseResponseOptions, ResponseOptions} from
* '@angular/http';
* import {App} from './myapp';
*
* class MyOptions extends BaseResponseOptions {
* headers:Headers = new Headers({network: 'github'});
* }
*
* bootstrap(App, [HTTP_PROVIDERS, {provide: ResponseOptions, useClass: MyOptions}]);
* ```
*
* The options could also be extended when manually creating a {@link Response}
* object.
*
* ### Example
*
* ```
* import {BaseResponseOptions, Response} from '@angular/http';
*
* var options = new BaseResponseOptions();
* var res = new Response(options.merge({
* body: 'Angular',
* headers: new Headers({framework: 'angular'})
* }));
* console.log('res.headers.get("framework"):', res.headers.get('framework')); // angular
* console.log('res.text():', res.text()); // Angular;
* ```
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class BaseResponseOptions extends ResponseOptions {
constructor();
}
/**
* A backend for http that uses the `XMLHttpRequest` browser API.
*
* Take care not to evaluate this in non-browser contexts.
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class BrowserXhr {
constructor();
build(): any;
}
/**
* Abstract class from which real connections are derived.
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare abstract class Connection {
readyState: ReadyState;
request: Request;
response: any;
}
/**
* Abstract class from which real backends are derived.
*
* The primary purpose of a `ConnectionBackend` is to create new connections to fulfill a given
* {@link Request}.
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare abstract class ConnectionBackend {
abstract createConnection(request: any): Connection;
}
/**
* Supported content type to be automatically associated with a {@link Request}.
* @deprecated see https://angular.io/guide/http
*/
declare enum ContentType {
NONE = 0,
JSON = 1,
FORM = 2,
FORM_DATA = 3,
TEXT = 4,
BLOB = 5,
ARRAY_BUFFER = 6
}
/**
* `XSRFConfiguration` sets up Cross Site Request Forgery (XSRF) protection for the application
* using a cookie. See https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)
* for more information on XSRF.
*
* Applications can configure custom cookie and header names by binding an instance of this class
* with different `cookieName` and `headerName` values. See the main HTTP documentation for more
* details.
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class CookieXSRFStrategy implements XSRFStrategy {
private _cookieName;
private _headerName;
constructor(_cookieName?: string, _headerName?: string);
configureRequest(req: Request): void;
}
/**
* Polyfill for [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers/Headers), as
* specified in the [Fetch Spec](https://fetch.spec.whatwg.org/#headers-class).
*
* The only known difference between this `Headers` implementation and the spec is the
* lack of an `entries` method.
*
* @usageNotes
* ### Example
*
* ```
* import {Headers} from '@angular/http';
*
* var firstHeaders = new Headers();
* firstHeaders.append('Content-Type', 'image/jpeg');
* console.log(firstHeaders.get('Content-Type')) //'image/jpeg'
*
* // Create headers from Plain Old JavaScript Object
* var secondHeaders = new Headers({
* 'X-My-Custom-Header': 'Angular'
* });
* console.log(secondHeaders.get('X-My-Custom-Header')); //'Angular'
*
* var thirdHeaders = new Headers(secondHeaders);
* console.log(thirdHeaders.get('X-My-Custom-Header')); //'Angular'
* ```
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class Headers {
constructor(headers?: Headers | {
[name: string]: any;
} | null);
/**
* Returns a new Headers instance from the given DOMString of Response Headers
*/
static fromResponseHeaderString(headersString: string): Headers;
/**
* Appends a header to existing list of header values for a given header name.
*/
append(name: string, value: string): void;
/**
* Deletes all header values for the given name.
*/
delete(name: string): void;
forEach(fn: (values: string[], name: string | undefined, headers: Map<string, string[]>) => void): void;
/**
* Returns first header that matches given name.
*/
get(name: string): string | null;
/**
* Checks for existence of header by given name.
*/
has(name: string): boolean;
/**
* Returns the names of the headers
*/
keys(): string[];
/**
* Sets or overrides header value for given name.
*/
set(name: string, value: string | string[]): void;
/**
* Returns values of all headers.
*/
values(): string[][];
/**
* Returns string of all headers.
*/
toJSON(): {
[name: string]: any;
};
/**
* Returns list of header values for a given name.
*/
getAll(name: string): string[] | null;
/**
* This method is not implemented.
*/
entries(): void;
private mayBeSetNormalizedName;
}
/**
* Performs http requests using `XMLHttpRequest` as the default backend.
*
* `Http` is available as an injectable class, with methods to perform http requests. Calling
* `request` returns an `Observable` which will emit a single {@link Response} when a
* response is received.
*
* @usageNotes
* ### Example
*
* ```typescript
* import {Http, HTTP_PROVIDERS} from '@angular/http';
* import {map} from 'rxjs/operators';
*
* @Component({
* selector: 'http-app',
* viewProviders: [HTTP_PROVIDERS],
* templateUrl: 'people.html'
* })
* class PeopleComponent {
* constructor(http: Http) {
* http.get('people.json')
* // Call map on the response observable to get the parsed people object
* .pipe(map(res => res.json()))
* // Subscribe to the observable to get the parsed people object and attach it to the
* // component
* .subscribe(people => this.people = people);
* }
* }
* ```
*
*
* ### Example
*
* ```
* http.get('people.json').subscribe((res:Response) => this.people = res.json());
* ```
*
* The default construct used to perform requests, `XMLHttpRequest`, is abstracted as a "Backend" (
* {@link XHRBackend} in this case), which could be mocked with dependency injection by replacing
* the {@link XHRBackend} provider, as in the following example:
*
* ### Example
*
* ```typescript
* import {BaseRequestOptions, Http} from '@angular/http';
* import {MockBackend} from '@angular/http/testing';
* var injector = Injector.resolveAndCreate([
* BaseRequestOptions,
* MockBackend,
* {provide: Http, useFactory:
* function(backend, defaultOptions) {
* return new Http(backend, defaultOptions);
* },
* deps: [MockBackend, BaseRequestOptions]}
* ]);
* var http = injector.get(Http);
* http.get('request-from-mock-backend.json').subscribe((res:Response) => doSomething(res));
* ```
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class Http {
protected _backend: ConnectionBackend;
protected _defaultOptions: RequestOptions;
constructor(_backend: ConnectionBackend, _defaultOptions: RequestOptions);
/**
* Performs any type of http request. First argument is required, and can either be a url or
* a {@link Request} instance. If the first argument is a url, an optional {@link RequestOptions}
* object can be provided as the 2nd argument. The options object will be merged with the values
* of {@link BaseRequestOptions} before performing the request.
*/
request(url: string | Request, options?: RequestOptionsArgs): Observable<Response>;
/**
* Performs a request with `get` http method.
*/
get(url: string, options?: RequestOptionsArgs): Observable<Response>;
/**
* Performs a request with `post` http method.
*/
post(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
/**
* Performs a request with `put` http method.
*/
put(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
/**
* Performs a request with `delete` http method.
*/
delete(url: string, options?: RequestOptionsArgs): Observable<Response>;
/**
* Performs a request with `patch` http method.
*/
patch(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
/**
* Performs a request with `head` http method.
*/
head(url: string, options?: RequestOptionsArgs): Observable<Response>;
/**
* Performs a request with `options` http method.
*/
options(url: string, options?: RequestOptionsArgs): Observable<Response>;
}
/**
* The module that includes http's providers
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class HttpModule {
}
/**
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class Jsonp extends Http {
constructor(backend: ConnectionBackend, defaultOptions: RequestOptions);
/**
* Performs any type of http request. First argument is required, and can either be a url or
* a {@link Request} instance. If the first argument is a url, an optional {@link RequestOptions}
* object can be provided as the 2nd argument. The options object will be merged with the values
* of {@link BaseRequestOptions} before performing the request.
*
* @security Regular XHR is the safest alternative to JSONP for most applications, and is
* supported by all current browsers. Because JSONP creates a `<script>` element with
* contents retrieved from a remote source, attacker-controlled data introduced by an untrusted
* source could expose your application to XSS risks. Data exposed by JSONP may also be
* readable by malicious third-party websites. In addition, JSONP introduces potential risk for
* future security issues (e.g. content sniffing). For more detail, see the
* [Security Guide](http://g.co/ng/security).
*/
request(url: string | Request, options?: RequestOptionsArgs): Observable<Response>;
}
/**
* A {@link ConnectionBackend} that uses the JSONP strategy of making requests.
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class JSONPBackend extends ConnectionBackend {
private _browserJSONP;
private _baseResponseOptions;
createConnection(request: Request): JSONPConnection;
}
/**
* Base class for an in-flight JSONP request.
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class JSONPConnection implements Connection {
private _dom;
private baseResponseOptions?;
private _id;
private _script;
private _responseData;
private _finished;
/**
* The {@link ReadyState} of this request.
*/
readyState: ReadyState;
/**
* The outgoing HTTP request.
*/
request: Request;
/**
* An observable that completes with the response, when the request is finished.
*/
response: Observable<Response>;
/**
* Callback called when the JSONP request completes, to notify the application
* of the new data.
*/
finished(data?: any): void;
}
/**
* The module that includes jsonp's providers
*
* @deprecated see https://angular.io/api/common/http/HttpClient#jsonp
* @publicApi
*/
export declare class JsonpModule {
}
/**
* @deprecated see https://angular.io/guide/http
* @publicApi
**/
export declare class QueryEncoder {
encodeKey(key: string): string;
encodeValue(value: string): string;
}
/**
* 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.
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare enum ReadyState {
Unsent = 0,
Open = 1,
HeadersReceived = 2,
Loading = 3,
Done = 4,
Cancelled = 5
}
/**
* Creates `Request` instances from provided values.
*
* The Request's interface is inspired by the Request constructor defined in the [Fetch
* Spec](https://fetch.spec.whatwg.org/#request-class),
* but is considered a static value whose body can be accessed many times. There are other
* differences in the implementation, but this is the most significant.
*
* `Request` instances are typically created by higher-level classes, like {@link Http} and
* {@link Jsonp}, but it may occasionally be useful to explicitly create `Request` instances.
* One such example is when creating services that wrap higher-level services, like {@link Http},
* where it may be useful to generate a `Request` with arbitrary headers and search params.
*
* ```typescript
* import {Injectable, Injector} from '@angular/core';
* import {HTTP_PROVIDERS, Http, Request, RequestMethod} from '@angular/http';
*
* @Injectable()
* class AutoAuthenticator {
* constructor(public http:Http) {}
* request(url:string) {
* return this.http.request(new Request({
* method: RequestMethod.Get,
* url: url,
* search: 'password=123'
* }));
* }
* }
*
* var injector = Injector.resolveAndCreate([HTTP_PROVIDERS, AutoAuthenticator]);
* var authenticator = injector.get(AutoAuthenticator);
* authenticator.request('people.json').subscribe(res => {
* //URL should have included '?password=123'
* console.log('people', res.json());
* });
* ```
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class Request extends ɵangular_packages_http_http_f {
/**
* Http method with which to perform the request.
*/
method: RequestMethod;
/**
* {@link Headers} instance
*/
headers: Headers;
/** Url of the remote resource */
url: string;
/** Type of the request body **/
private contentType;
/** Enable use credentials */
withCredentials: boolean;
/** Buffer to store the response */
responseType: ResponseContentType;
constructor(requestOptions: ɵangular_packages_http_http_d);
/**
* Returns the content type enum based on header options.
*/
detectContentType(): ContentType;
/**
* Returns the content type of request's body based on its type.
*/
detectContentTypeFromBody(): ContentType;
/**
* Returns the request's body according to its type. If body is undefined, return
* null.
*/
getBody(): any;
}
/**
* Supported http methods.
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare enum RequestMethod {
Get = 0,
Post = 1,
Put = 2,
Delete = 3,
Options = 4,
Head = 5,
Patch = 6
}
/**
* Creates a request options object to be optionally provided when instantiating a
* {@link Request}.
*
* This class is based on the `RequestInit` description in the [Fetch
* Spec](https://fetch.spec.whatwg.org/#requestinit).
*
* All values are null by default. Typical defaults can be found in the {@link BaseRequestOptions}
* class, which sub-classes `RequestOptions`.
*
* ```typescript
* import {RequestOptions, Request, RequestMethod} from '@angular/http';
*
* const options = new RequestOptions({
* method: RequestMethod.Post,
* url: 'https://google.com'
* });
* const req = new Request(options);
* console.log('req.method:', RequestMethod[req.method]); // Post
* console.log('options.url:', options.url); // https://google.com
* ```
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class RequestOptions {
/**
* Http method with which to execute a {@link Request}.
* Acceptable methods are defined in the {@link RequestMethod} enum.
*/
method: RequestMethod | string | null;
/**
* {@link Headers} to be attached to a {@link Request}.
*/
headers: Headers | null;
/**
* Body to be used when creating a {@link Request}.
*/
body: any;
/**
* Url with which to perform a {@link Request}.
*/
url: string | null;
/**
* Search parameters to be included in a {@link Request}.
*/
params: URLSearchParams;
/**
* @deprecated from 4.0.0. Use params instead.
*/
/**
* @deprecated from 4.0.0. Use params instead.
*/
search: URLSearchParams;
/**
* Enable use credentials for a {@link Request}.
*/
withCredentials: boolean | null;
responseType: ResponseContentType | null;
constructor(opts?: RequestOptionsArgs);
/**
* Creates a copy of the `RequestOptions` instance, using the optional input as values to override
* existing values. This method will not change the values of the instance on which it is being
* called.
*
* Note that `headers` and `search` will override existing values completely if present in
* the `options` object. If these values should be merged, it should be done prior to calling
* `merge` on the `RequestOptions` instance.
*
* ```typescript
* import {RequestOptions, Request, RequestMethod} from '@angular/http';
*
* const options = new RequestOptions({
* method: RequestMethod.Post
* });
* const req = new Request(options.merge({
* url: 'https://google.com'
* }));
* console.log('req.method:', RequestMethod[req.method]); // Post
* console.log('options.url:', options.url); // null
* console.log('req.url:', req.url); // https://google.com
* ```
*/
merge(options?: RequestOptionsArgs): RequestOptions;
private _mergeSearchParams;
private _parseParams;
private _appendParam;
}
/**
* Interface for options to construct a RequestOptions, based on
* [RequestInit](https://fetch.spec.whatwg.org/#requestinit) from the Fetch spec.
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare interface RequestOptionsArgs {
url?: string | null;
method?: string | RequestMethod | null;
/** @deprecated from 4.0.0. Use params instead. */
search?: string | URLSearchParams | {
[key: string]: any | any[];
} | null;
params?: string | URLSearchParams | {
[key: string]: any | any[];
} | null;
headers?: Headers | null;
body?: any;
withCredentials?: boolean | null;
responseType?: ResponseContentType | null;
}
/**
* Creates `Response` instances from provided values.
*
* Though this object isn't
* usually instantiated by end-users, it is the primary object interacted with when it comes time to
* add data to a view.
*
* @usageNotes
* ### Example
*
* ```
* http.request('my-friends.txt').subscribe(response => this.friends = response.text());
* ```
*
* The Response's interface is inspired by the Response constructor defined in the [Fetch
* Spec](https://fetch.spec.whatwg.org/#response-class), but is considered a static value whose body
* can be accessed many times. There are other differences in the implementation, but this is the
* most significant.
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class Response extends ɵangular_packages_http_http_f {
/**
* One of "basic", "cors", "default", "error", or "opaque".
*
* Defaults to "default".
*/
type: ResponseType;
/**
* True if the response's status is within 200-299
*/
ok: boolean;
/**
* URL of response.
*
* Defaults to empty string.
*/
url: string;
/**
* Status code returned by server.
*
* Defaults to 200.
*/
status: number;
/**
* Text representing the corresponding reason phrase to the `status`, as defined in [ietf rfc 2616
* section 6.1.1](https://tools.ietf.org/html/rfc2616#section-6.1.1)
*
* Defaults to "OK"
*/
statusText: string | null;
/**
* Non-standard property
*
* Denotes how many of the response body's bytes have been loaded, for example if the response is
* the result of a progress event.
*/
bytesLoaded: number;
/**
* Non-standard property
*
* Denotes how many bytes are expected in the final response body.
*/
totalBytes: number;
/**
* Headers object based on the `Headers` class in the [Fetch
* Spec](https://fetch.spec.whatwg.org/#headers-class).
*/
headers: Headers | null;
constructor(responseOptions: ResponseOptions);
toString(): string;
}
/**
* Define which buffer to use to store the response
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare enum ResponseContentType {
Text = 0,
Json = 1,
ArrayBuffer = 2,
Blob = 3
}
/**
* Creates a response options object to be optionally provided when instantiating a
* {@link Response}.
*
* This class is based on the `ResponseInit` description in the [Fetch
* Spec](https://fetch.spec.whatwg.org/#responseinit).
*
* All values are null by default. Typical defaults can be found in the
* {@link BaseResponseOptions} class, which sub-classes `ResponseOptions`.
*
* This class may be used in tests to build {@link Response Responses} for
* mock responses (see {@link MockBackend}).
*
* @usageNotes
* ### Example
*
* ```typescript
* import {ResponseOptions, Response} from '@angular/http';
*
* var options = new ResponseOptions({
* body: '{"name":"Jeff"}'
* });
* var res = new Response(options);
*
* console.log('res.json():', res.json()); // Object {name: "Jeff"}
* ```
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class ResponseOptions {
/**
* String, Object, ArrayBuffer or Blob representing the body of the {@link Response}.
*/
body: string | Object | ArrayBuffer | Blob | null;
/**
* Http {@link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html status code}
* associated with the response.
*/
status: number | null;
/**
* Response {@link Headers headers}
*/
headers: Headers | null;
url: string | null;
constructor(opts?: ResponseOptionsArgs);
/**
* Creates a copy of the `ResponseOptions` instance, using the optional input as values to
* override
* existing values. This method will not change the values of the instance on which it is being
* called.
*
* This may be useful when sharing a base `ResponseOptions` object inside tests,
* where certain properties may change from test to test.
*
* @usageNotes
* ### Example
*
* ```typescript
* import {ResponseOptions, Response} from '@angular/http';
*
* var options = new ResponseOptions({
* body: {name: 'Jeff'}
* });
* var res = new Response(options.merge({
* url: 'https://google.com'
* }));
* console.log('options.url:', options.url); // null
* console.log('res.json():', res.json()); // Object {name: "Jeff"}
* console.log('res.url:', res.url); // https://google.com
* ```
*/
merge(options?: ResponseOptionsArgs): ResponseOptions;
}
/**
* Interface for options to construct a Response, based on
* [ResponseInit](https://fetch.spec.whatwg.org/#responseinit) from the Fetch spec.
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare interface ResponseOptionsArgs {
body?: string | Object | FormData | ArrayBuffer | Blob | null;
status?: number | null;
statusText?: string | null;
headers?: Headers | null;
type?: ResponseType | null;
url?: string | null;
}
/**
* Acceptable response types to be associated with a {@link Response}, based on
* [ResponseType](https://fetch.spec.whatwg.org/#responsetype) from the Fetch spec.
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare enum ResponseType {
Basic = 0,
Cors = 1,
Default = 2,
Error = 3,
Opaque = 4
}
/**
* Map-like representation of url search parameters, based on
* [URLSearchParams](https://url.spec.whatwg.org/#urlsearchparams) in the url living standard,
* with several extensions for merging URLSearchParams objects:
* - setAll()
* - appendAll()
* - replaceAll()
*
* This class accepts an optional second parameter of ${@link QueryEncoder},
* which is used to serialize parameters before making a request. By default,
* `QueryEncoder` encodes keys and values of parameters using `encodeURIComponent`,
* and then un-encodes certain characters that are allowed to be part of the query
* according to IETF RFC 3986: https://tools.ietf.org/html/rfc3986.
*
* These are the characters that are not encoded: `! $ \' ( ) * + , ; A 9 - . _ ~ ? /`
*
* If the set of allowed query characters is not acceptable for a particular backend,
* `QueryEncoder` can be subclassed and provided as the 2nd argument to URLSearchParams.
*
* ```
* import {URLSearchParams, QueryEncoder} from '@angular/http';
* class MyQueryEncoder extends QueryEncoder {
* encodeKey(k: string): string {
* return myEncodingFunction(k);
* }
*
* encodeValue(v: string): string {
* return myEncodingFunction(v);
* }
* }
*
* let params = new URLSearchParams('', new MyQueryEncoder());
* ```
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class URLSearchParams {
rawParams: string;
private queryEncoder;
paramsMap: Map<string, string[]>;
constructor(rawParams?: string, queryEncoder?: QueryEncoder);
clone(): URLSearchParams;
has(param: string): boolean;
get(param: string): string | null;
getAll(param: string): string[];
set(param: string, val: string): void;
setAll(searchParams: URLSearchParams): void;
append(param: string, val: string): void;
appendAll(searchParams: URLSearchParams): void;
replaceAll(searchParams: URLSearchParams): void;
toString(): string;
delete(param: string): void;
}
/**
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare const VERSION: Version;
/**
* Creates {@link XHRConnection} instances.
*
* This class would typically not be used by end users, but could be
* overridden if a different backend implementation should be used,
* such as in a node backend.
*
* @usageNotes
* ### Example
*
* ```
* import {Http, MyNodeBackend, HTTP_PROVIDERS, BaseRequestOptions} from '@angular/http';
* @Component({
* viewProviders: [
* HTTP_PROVIDERS,
* {provide: Http, useFactory: (backend, options) => {
* return new Http(backend, options);
* }, deps: [MyNodeBackend, BaseRequestOptions]}]
* })
* class MyComponent {
* constructor(http:Http) {
* http.request('people.json').subscribe(res => this.people = res.json());
* }
* }
* ```
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class XHRBackend implements ConnectionBackend {
private _browserXHR;
private _baseResponseOptions;
private _xsrfStrategy;
constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy);
createConnection(request: Request): XHRConnection;
}
/**
* Creates connections using `XMLHttpRequest`. Given a fully-qualified
* request, an `XHRConnection` will immediately create an `XMLHttpRequest` object and send the
* request.
*
* This class would typically not be created or interacted with directly inside applications, though
* the {@link MockConnection} may be interacted with in tests.
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare class XHRConnection implements Connection {
request: Request;
/**
* Response {@link EventEmitter} which emits a single {@link Response} value on load event of
* `XMLHttpRequest`.
*/
response: Observable<Response>;
readyState: ReadyState;
constructor(req: Request, browserXHR: BrowserXhr, baseResponseOptions?: ResponseOptions);
setDetectedContentType(req: any /** TODO Request */, _xhr: any /** XMLHttpRequest */): void;
}
/**
* An XSRFStrategy configures XSRF protection (e.g. via headers) on an HTTP request.
*
* @deprecated see https://angular.io/guide/http
* @publicApi
*/
export declare abstract class XSRFStrategy {
abstract configureRequest(req: Request): void;
}
export declare function ɵangular_packages_http_http_a(): CookieXSRFStrategy;
export declare function ɵangular_packages_http_http_b(xhrBackend: XHRBackend, requestOptions: RequestOptions): Http;
export declare function ɵangular_packages_http_http_c(jsonpBackend: JSONPBackend, requestOptions: RequestOptions): Jsonp;
/**
* Required structure when constructing new Request();
*/
export declare interface ɵangular_packages_http_http_d extends RequestOptionsArgs {
url: string | null;
}
export declare class ɵangular_packages_http_http_e {
build(url: string): any;
nextRequestID(): string;
requestCallback(id: string): string;
exposeConnection(id: string, connection: any): void;
removeConnection(id: string): void;
send(node: any): void;
cleanup(node: any): void;
}
/**
* HTTP request body used by both {@link Request} and {@link Response}
* https://fetch.spec.whatwg.org/#body
*/
export declare abstract class ɵangular_packages_http_http_f {
/**
* Attempts to return body as parsed `JSON` object, or raises an exception.
*/
json(): any;
/**
* Returns the body as a string, presuming `toString()` can be called on the response body.
*
* When decoding an `ArrayBuffer`, the optional `encodingHint` parameter determines how the
* bytes in the buffer will be interpreted. Valid values are:
*
* - `legacy` - incorrectly interpret the bytes as UTF-16 (technically, UCS-2). Only characters
* in the Basic Multilingual Plane are supported, surrogate pairs are not handled correctly.
* In addition, the endianness of the 16-bit octet pairs in the `ArrayBuffer` is not taken
* into consideration. This is the default behavior to avoid breaking apps, but should be
* considered deprecated.
*
* - `iso-8859` - interpret the bytes as ISO-8859 (which can be used for ASCII encoded text).
*/
text(encodingHint?: 'legacy' | 'iso-8859'): string;
/**
* Return the body as an ArrayBuffer
*/
arrayBuffer(): ArrayBuffer;
/**
* Returns the request's body as a Blob, assuming that body exists.
*/
blob(): Blob;
}
export { }