fix(http): use params without RequestOptions (#14101)

`params` has been introduced in 4.0.0-beta.0

Before:

    http.get(url, new RequestOptions({params: searchParams}))

After:

    http.get(url, {params: searchParams})

Fixes #14100

PR Close #14101
This commit is contained in:
cexbrayat 2017-01-25 16:42:30 +01:00 committed by Miško Hevery
parent c87c3bec93
commit 5f2b3173d7
2 changed files with 14 additions and 2 deletions

View File

@ -28,6 +28,7 @@ function mergeOptions(
method: providedOpts.method || method,
url: providedOpts.url || url,
search: providedOpts.search,
params: providedOpts.params,
headers: providedOpts.headers,
body: providedOpts.body,
withCredentials: providedOpts.withCredentials,

View File

@ -353,7 +353,6 @@ export function main() {
.subscribe((res: Response) => {});
}));
it('should append string search params to url',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
backend.connections.subscribe((c: MockConnection) => {
@ -365,7 +364,6 @@ export function main() {
.subscribe((res: Response) => {});
}));
it('should produce valid url when url already contains a query',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
backend.connections.subscribe((c: MockConnection) => {
@ -378,6 +376,19 @@ export function main() {
}));
});
describe('params', () => {
it('should append params to url',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
backend.connections.subscribe((c: MockConnection) => {
expect(c.request.url).toEqual('https://www.google.com?q=puppies');
backend.resolveAllConnections();
async.done();
});
http.get('https://www.google.com', {params: {q: 'puppies'}})
.subscribe((res: Response) => {});
}));
});
describe('string method names', () => {
it('should allow case insensitive strings for method names', () => {
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {