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

Method headers

lib.esm/utils/fetch.js:231–247  ·  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

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

Callers

nothing calls this directly

Calls 2

encodeBase64Function · 0.90
toUtf8BytesFunction · 0.90

Tested by

no test coverage detected