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:
@ -28,6 +28,7 @@ function mergeOptions(
|
|||||||
method: providedOpts.method || method,
|
method: providedOpts.method || method,
|
||||||
url: providedOpts.url || url,
|
url: providedOpts.url || url,
|
||||||
search: providedOpts.search,
|
search: providedOpts.search,
|
||||||
|
params: providedOpts.params,
|
||||||
headers: providedOpts.headers,
|
headers: providedOpts.headers,
|
||||||
body: providedOpts.body,
|
body: providedOpts.body,
|
||||||
withCredentials: providedOpts.withCredentials,
|
withCredentials: providedOpts.withCredentials,
|
||||||
|
@ -353,7 +353,6 @@ export function main() {
|
|||||||
.subscribe((res: Response) => {});
|
.subscribe((res: Response) => {});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('should append string search params to url',
|
it('should append string search params to url',
|
||||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||||
backend.connections.subscribe((c: MockConnection) => {
|
backend.connections.subscribe((c: MockConnection) => {
|
||||||
@ -365,7 +364,6 @@ export function main() {
|
|||||||
.subscribe((res: Response) => {});
|
.subscribe((res: Response) => {});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('should produce valid url when url already contains a query',
|
it('should produce valid url when url already contains a query',
|
||||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||||
backend.connections.subscribe((c: MockConnection) => {
|
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', () => {
|
describe('string method names', () => {
|
||||||
it('should allow case insensitive strings for method names', () => {
|
it('should allow case insensitive strings for method names', () => {
|
||||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||||
|
Reference in New Issue
Block a user