* Serializes the body to an encoded string, where key-value pairs (separated by `=`) are * separated by `&`s.
()
| 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); |