MCPcopy Create free account
hub / github.com/firebase/firebase-tools / constructCallableFunc

Method constructCallableFunc

src/localFunction.ts:39–60  ·  view source on GitHub ↗
(data: string | object, opts: { instanceIdToken?: string })

Source from the content-addressed store, hash-verified

37 }
38
39 private constructCallableFunc(data: string | object, opts: { instanceIdToken?: string }): void {
40 opts = opts || {};
41
42 const headers: Record<string, string> = {};
43 if (opts.instanceIdToken) {
44 headers["Firebase-Instance-ID-Token"] = opts.instanceIdToken;
45 }
46
47 if (!this.url) {
48 throw new Error("No URL provided");
49 }
50
51 const client = new Client({ urlPrefix: this.url, auth: false });
52 void client
53 .post<any, any>("", data, { headers })
54 .then((res) => {
55 this.requestCallBack<any>(undefined, res, res.body);
56 })
57 .catch((err) => {
58 this.requestCallBack(err);
59 });
60 }
61
62 private constructHttpsFunc(): requestShim {
63 if (!this.url) {

Callers 1

makeFnMethod · 0.95

Calls 1

requestCallBackMethod · 0.95

Tested by

no test coverage detected