* The headers that will be used when requesting the URI. All * keys are lower-case. * * This object is a copy, so any changes will **NOT** be reflected * in the ``FetchRequest``. * * To set a header entry, use the ``setHeader`` method.
()
| 284 | * To set a header entry, use the ``setHeader`` method. |
| 285 | */ |
| 286 | get headers(): Record<string, string> { |
| 287 | const headers = Object.assign({ }, this.#headers); |
| 288 | |
| 289 | if (this.#creds) { |
| 290 | headers["authorization"] = `Basic ${ encodeBase64(toUtf8Bytes(this.#creds)) }`; |
| 291 | }; |
| 292 | |
| 293 | if (this.allowGzip) { |
| 294 | headers["accept-encoding"] = "gzip"; |
| 295 | } |
| 296 | |
| 297 | if (headers["content-type"] == null && this.#bodyType) { |
| 298 | headers["content-type"] = this.#bodyType; |
| 299 | } |
| 300 | if (this.body) { headers["content-length"] = String(this.body.length); } |
| 301 | |
| 302 | return headers; |
| 303 | } |
| 304 | |
| 305 | /** |
| 306 | * Get the header for %%key%%, ignoring case. |
nothing calls this directly
no test coverage detected