MCPcopy Index your code
hub / github.com/angular/angular / toString

Method toString

packages/common/http/src/params.ts:294–312  ·  view source on GitHub ↗

* Serializes the body to an encoded string, where key-value pairs (separated by `=`) are * separated by `&`s.

()

Source from the content-addressed store, hash-verified

292 * separated by `&`s.
293 */
294 toString(): string {
295 this.init();
296 return (
297 this.keys()
298 .map((key) => {
299 const eKey = this.encoder.encodeKey(key);
300 // `a: ['1']` produces `'a=1'`
301 // `b: []` produces `''`
302 // `c: ['1', '2']` produces `'c=1&c=2'`
303 return this.map!.get(key)!
304 .map((value) => eKey + '=' + this.encoder.encodeValue(value))
305 .join('&');
306 })
307 // filter out empty values because `b: []` produces `''`
308 // which results in `a=1&&c=1&c=2` instead of `a=1&c=1&c=2` if we don't
309 .filter((param) => param !== '')
310 .join('&')
311 );
312 }
313
314 private clone(update: Update | Update[]): HttpParams {
315 const clone = new HttpParams({encoder: this.encoder} as HttpParamsOptions);

Callers

nothing calls this directly

Calls 8

initMethod · 0.95
keysMethod · 0.95
mapMethod · 0.80
joinMethod · 0.65
encodeKeyMethod · 0.65
getMethod · 0.65
encodeValueMethod · 0.65
filterMethod · 0.45

Tested by

no test coverage detected