1
|
import { Observable } from 'rxjs/Observable';
|
2
|
import { HttpBackend, HttpHandler } from './backend';
|
3
|
import { HttpRequest } from './request';
|
4
|
import { HttpEvent } from './response';
|
5
|
export declare const JSONP_ERR_NO_CALLBACK = "JSONP injected script did not invoke callback.";
|
6
|
export declare const JSONP_ERR_WRONG_METHOD = "JSONP requests must use JSONP request method.";
|
7
|
export declare const JSONP_ERR_WRONG_RESPONSE_TYPE = "JSONP requests must use Json response type.";
|
8
|
/**
|
9
|
* DI token/abstract type representing a map of JSONP callbacks.
|
10
|
*
|
11
|
* In the browser, this should always be the `window` object.
|
12
|
*
|
13
|
* @experimental
|
14
|
*/
|
15
|
export declare abstract class JsonpCallbackContext {
|
16
|
[key: string]: (data: any) => void;
|
17
|
}
|
18
|
/**
|
19
|
* `HttpBackend` that only processes `HttpRequest` with the JSONP method,
|
20
|
* by performing JSONP style requests.
|
21
|
*
|
22
|
* @experimental
|
23
|
*/
|
24
|
export declare class JsonpClientBackend implements HttpBackend {
|
25
|
private callbackMap;
|
26
|
private document;
|
27
|
constructor(callbackMap: JsonpCallbackContext, document: any);
|
28
|
/**
|
29
|
* Get the name of the next callback method, by incrementing the global `nextRequestId`.
|
30
|
*/
|
31
|
private nextCallback();
|
32
|
/**
|
33
|
* Process a JSONP request and return an event stream of the results.
|
34
|
*/
|
35
|
handle(req: HttpRequest<never>): Observable<HttpEvent<any>>;
|
36
|
}
|
37
|
/**
|
38
|
* An `HttpInterceptor` which identifies requests with the method JSONP and
|
39
|
* shifts them to the `JsonpClientBackend`.
|
40
|
*
|
41
|
* @experimental
|
42
|
*/
|
43
|
export declare class JsonpInterceptor {
|
44
|
private jsonp;
|
45
|
constructor(jsonp: JsonpClientBackend);
|
46
|
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
|
47
|
}
|