diff --git a/packages/common/http/public_api.ts b/packages/common/http/public_api.ts index 7766d768d2..ebc2e7cd20 100644 --- a/packages/common/http/public_api.ts +++ b/packages/common/http/public_api.ts @@ -12,7 +12,7 @@ export {HttpHeaders} from './src/headers'; export {HTTP_INTERCEPTORS, HttpInterceptor} from './src/interceptor'; export {JsonpClientBackend, JsonpInterceptor} from './src/jsonp'; export {HttpClientJsonpModule, HttpClientModule, interceptingHandler as ɵinterceptingHandler} from './src/module'; +export {HttpParameterCodec, HttpParams, HttpUrlEncodingCodec} from './src/params'; export {HttpRequest} from './src/request'; export {HttpDownloadProgressEvent, HttpErrorResponse, HttpEvent, HttpEventType, HttpHeaderResponse, HttpProgressEvent, HttpResponse, HttpResponseBase, HttpSentEvent, HttpUserEvent} from './src/response'; -export {HttpStandardUrlParameterCodec, HttpUrlEncodedBody, HttpUrlParameterCodec} from './src/url_encoded_body'; -export {HttpXhrBackend, XhrFactory} from './src/xhr'; \ No newline at end of file +export {HttpXhrBackend, XhrFactory} from './src/xhr'; diff --git a/packages/common/http/src/client.ts b/packages/common/http/src/client.ts index 7ea0c10cac..92e0334433 100644 --- a/packages/common/http/src/client.ts +++ b/packages/common/http/src/client.ts @@ -15,6 +15,7 @@ import {map} from 'rxjs/operator/map'; import {HttpHandler} from './backend'; import {HttpHeaders} from './headers'; +import {HttpParams} from './params'; import {HttpRequest} from './request'; import {HttpEvent, HttpEventType, HttpResponse} from './response'; @@ -27,6 +28,7 @@ function addBody( options: { headers?: HttpHeaders, observe?: HttpObserve, + params?: HttpParams, responseType?: 'arraybuffer' | 'blob' | 'json' | 'text', withCredentials?: boolean, }, @@ -35,6 +37,7 @@ function addBody( body, headers: options.headers, observe: options.observe, + params: options.params, responseType: options.responseType, withCredentials: options.withCredentials, }; @@ -59,70 +62,75 @@ export class HttpClient { body?: any, headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; request(method: string, url: string, options: { body?: any, headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable; request(method: string, url: string, options: { body?: any, headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable; request(method: string, url: string, options: { body?: any, headers?: HttpHeaders, + params?: HttpParams, observe: 'events', responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; request(method: string, url: string, options: { body?: any, headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; request(method: string, url: string, options: { body?: any, headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; request(method: string, url: string, options: { body?: any, headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; request(method: string, url: string, options: { body?: any, headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; request(method: string, url: string, options: { body?: any, headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; request(method: string, url: string, options: { body?: any, headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; request(method: string, url: string, options: { body?: any, headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; request(method: string, url: string, options?: { body?: any, headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; @@ -130,12 +138,14 @@ export class HttpClient { body?: any, headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; request(method: string, url: string, options?: { body?: any, headers?: HttpHeaders, + params?: HttpParams, observe?: HttpObserve, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, @@ -175,6 +185,7 @@ export class HttpClient { body?: any, headers?: HttpHeaders, observe?: HttpObserve, + params?: HttpParams, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, } = {}): Observable { @@ -190,6 +201,7 @@ export class HttpClient { // provided. req = new HttpRequest(first, url !, options.body || null, { headers: options.headers, + params: options.params, // By default, JSON is assumed to be returned for all calls. responseType: options.responseType || 'json', withCredentials: options.withCredentials, @@ -266,73 +278,78 @@ export class HttpClient { delete (url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; delete (url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable; delete (url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable; delete (url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; delete (url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; delete (url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; delete (url: string, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; delete(url: string, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; delete (url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; delete (url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; delete (url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; delete (url: string, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; delete(url: string, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; delete (url: string, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; delete(url: string, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; @@ -344,6 +361,7 @@ export class HttpClient { delete (url: string, options: { headers?: HttpHeaders, observe?: HttpObserve, + params?: HttpParams, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, } = {}): Observable { @@ -353,73 +371,78 @@ export class HttpClient { get(url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; get(url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable; get(url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable; get(url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; get(url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; get(url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; get(url: string, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; get(url: string, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; get(url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; get(url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; get(url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; get(url: string, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; get(url: string, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; get(url: string, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; get(url: string, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; @@ -431,6 +454,7 @@ export class HttpClient { get(url: string, options: { headers?: HttpHeaders, observe?: HttpObserve, + params?: HttpParams, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, } = {}): Observable { @@ -440,73 +464,78 @@ export class HttpClient { head(url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; head(url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable; head(url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable; head(url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; head(url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; head(url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; head(url: string, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; head(url: string, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; head(url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; head(url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; head(url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; head(url: string, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; head(url: string, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; head(url: string, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; head(url: string, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; @@ -518,14 +547,15 @@ export class HttpClient { head(url: string, options: { headers?: HttpHeaders, observe?: HttpObserve, + params?: HttpParams, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, } = {}): Observable { return this.request('HEAD', url, options as any); } - jsonp(url: string): Observable; - jsonp(url: string): Observable; + jsonp(url: string, callbackParam: string): Observable; + jsonp(url: string, callbackParam: string): Observable; /** * Constructs an `Observable` which, when subscribed, will cause a request * with the special method `JSONP` to be dispatched via the interceptor pipeline. @@ -534,8 +564,9 @@ export class HttpClient { * If no such interceptor is reached, then the `JSONP` request will likely be * rejected by the configured backend. */ - jsonp(url: string): Observable { + jsonp(url: string, callbackParam: string): Observable { return this.request('JSONP', url, { + params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'), observe: 'body', responseType: 'json', }); @@ -544,73 +575,78 @@ export class HttpClient { options(url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; options(url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable; options(url: string, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable; options(url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; options(url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; options(url: string, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; options(url: string, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; options(url: string, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; options(url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; options(url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; options(url: string, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; options(url: string, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; options(url: string, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; options(url: string, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; options(url: string, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; @@ -622,6 +658,7 @@ export class HttpClient { options(url: string, options: { headers?: HttpHeaders, observe?: HttpObserve, + params?: HttpParams, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, } = {}): Observable { @@ -631,73 +668,78 @@ export class HttpClient { patch(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; patch(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable; patch(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable; patch(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; patch(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; patch(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; patch(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; patch(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; patch(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; patch(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; patch(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; patch(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; patch(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; patch(url: string, body: any|null, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; patch(url: string, body: any|null, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; @@ -709,6 +751,7 @@ export class HttpClient { patch(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: HttpObserve, + params?: HttpParams, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, } = {}): Observable { @@ -718,73 +761,78 @@ export class HttpClient { post(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; post(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable; post(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable; post(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; post(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; post(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; post(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; post(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; post(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; post(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; post(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; post(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; post(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; post(url: string, body: any|null, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; post(url: string, body: any|null, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; @@ -796,6 +844,7 @@ export class HttpClient { post(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: HttpObserve, + params?: HttpParams, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, } = {}): Observable { @@ -805,36 +854,39 @@ export class HttpClient { put(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; put(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable; put(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable; put(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; put(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; put(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', + observe: 'events', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; put(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'events', responseType?: 'json', withCredentials?: boolean, + observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; put(url: string, body: any|null, options: { headers?: HttpHeaders, @@ -842,36 +894,38 @@ export class HttpClient { }): Observable>; put(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; put(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'blob', withCredentials?: boolean, }): Observable>; put(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', + observe: 'response', params?: HttpParams, responseType: 'text', withCredentials?: boolean, }): Observable>; put(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; put(url: string, body: any|null, options: { headers?: HttpHeaders, - observe: 'response', responseType?: 'json', withCredentials?: boolean, + observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable>; put(url: string, body: any|null, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; put(url: string, body: any|null, options?: { headers?: HttpHeaders, observe?: 'body', + params?: HttpParams, responseType?: 'json', withCredentials?: boolean, }): Observable; @@ -883,6 +937,7 @@ export class HttpClient { put(url: string, body: any|null, options: { headers?: HttpHeaders, observe?: HttpObserve, + params?: HttpParams, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, } = {}): Observable { diff --git a/packages/common/http/src/jsonp.ts b/packages/common/http/src/jsonp.ts index aa1a61c008..0d6825c0db 100644 --- a/packages/common/http/src/jsonp.ts +++ b/packages/common/http/src/jsonp.ts @@ -73,7 +73,7 @@ export class JsonpClientBackend implements HttpBackend { // callback placeholder in the URL with the name. Care has to be taken here to ensure // a trailing &, if matched, gets inserted back into the URL in the correct place. const callback = this.nextCallback(); - const url = req.url.replace(/=JSONP_CALLBACK(&|$)/, `=${callback}$1`); + const url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, `=${callback}$1`); // Construct the