MCPcopy Create free account
hub / github.com/PageLeay/celestial-runtime / headers

Method headers

src.ts/utils/fetch.ts:286–303  ·  view source on GitHub ↗

* 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.

()

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 2

encodeBase64Function · 0.90
toUtf8BytesFunction · 0.90

Tested by

no test coverage detected