* 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.
()
| 229 | * To set a header entry, use the ``setHeader`` method. |
| 230 | */ |
| 231 | get headers() { |
| 232 | const headers = Object.assign({}, this.#headers); |
| 233 | if (this.#creds) { |
| 234 | headers["authorization"] = `Basic ${encodeBase64(toUtf8Bytes(this.#creds))}`; |
| 235 | } |
| 236 | ; |
| 237 | if (this.allowGzip) { |
| 238 | headers["accept-encoding"] = "gzip"; |
| 239 | } |
| 240 | if (headers["content-type"] == null && this.#bodyType) { |
| 241 | headers["content-type"] = this.#bodyType; |
| 242 | } |
| 243 | if (this.body) { |
| 244 | headers["content-length"] = String(this.body.length); |
| 245 | } |
| 246 | return headers; |
| 247 | } |
| 248 | /** |
| 249 | * Get the header for %%key%%, ignoring case. |
| 250 | */ |
nothing calls this directly
no test coverage detected