Skip to content

Commit 9a66d71

Browse files
committed
Formatter
1 parent 8e7735b commit 9a66d71

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

spec/v2/providers/https.spec.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,13 @@ describe("onCall", () => {
536536
describe("authPolicy", () => {
537537
function req(data: any, auth?: Record<string, string>): any {
538538
const headers = {
539-
"content-type": "application/json"
539+
"content-type": "application/json",
540540
};
541541
if (auth) {
542-
headers["authorization"] = `bearer ignored.${Buffer.from(JSON.stringify(auth), "utf-8").toString("base64")}.ignored`;
542+
headers["authorization"] = `bearer ignored.${Buffer.from(
543+
JSON.stringify(auth),
544+
"utf-8"
545+
).toString("base64")}.ignored`;
543546
}
544547
const ret = new MockRequest({ data }, headers);
545548
ret.method = "POST";
@@ -552,7 +555,7 @@ describe("onCall", () => {
552555

553556
after(() => {
554557
sinon.restore();
555-
})
558+
});
556559

557560
it("should check isSignedIn", async () => {
558561
const func = https.onCall(
@@ -561,7 +564,7 @@ describe("onCall", () => {
561564
},
562565
() => 42
563566
);
564-
567+
565568
const authResp = await runHandler(func, req(null, { sub: "inlined" }));
566569
expect(authResp.status).to.equal(200);
567570

@@ -574,24 +577,24 @@ describe("onCall", () => {
574577
{
575578
authPolicy: https.hasClaim("meaning"),
576579
},
577-
() => "HHGTTG",
580+
() => "HHGTTG"
578581
);
579582
const specificValue = https.onCall(
580583
{
581584
authPolicy: https.hasClaim("meaning", "42"),
582585
},
583-
() => "HHGTG",
584-
)
585-
586-
const cases: Array<{fn: Handler, auth: null | Record<string, string>, status: number}> = [
587-
{fn: anyValue, auth: { meaning: "42"}, status: 200},
588-
{fn: anyValue, auth: { meaning: "43"}, status: 200},
589-
{fn: anyValue, auth: { order: "66"}, status: 403},
590-
{fn: anyValue, auth: null, status: 403},
591-
{fn: specificValue, auth: { meaning: "42"}, status: 200},
592-
{fn: specificValue, auth: { meaning: "43"}, status: 403},
593-
{fn: specificValue, auth: { order: "66", }, status: 403},
594-
{fn: specificValue, auth: null, status: 403},
586+
() => "HHGTG"
587+
);
588+
589+
const cases: Array<{ fn: Handler; auth: null | Record<string, string>; status: number }> = [
590+
{ fn: anyValue, auth: { meaning: "42" }, status: 200 },
591+
{ fn: anyValue, auth: { meaning: "43" }, status: 200 },
592+
{ fn: anyValue, auth: { order: "66" }, status: 403 },
593+
{ fn: anyValue, auth: null, status: 403 },
594+
{ fn: specificValue, auth: { meaning: "42" }, status: 200 },
595+
{ fn: specificValue, auth: { meaning: "43" }, status: 403 },
596+
{ fn: specificValue, auth: { order: "66" }, status: 403 },
597+
{ fn: specificValue, auth: null, status: 403 },
595598
];
596599
for (const test of cases) {
597600
const resp = await runHandler(test.fn, req(null, test.auth));

src/v2/providers/https.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,7 @@ export function onCall<T = any, Return = any | Promise<any>>(
421421
}
422422

423423
// fix the length of handler to make the call to handler consistent
424-
const fixedLen = (req: CallableRequest<T>, resp?: CallableProxyResponse) =>
425-
handler(req, resp);
424+
const fixedLen = (req: CallableRequest<T>, resp?: CallableProxyResponse) => handler(req, resp);
426425
let func: any = onCallHandler(
427426
{
428427
cors: { origin, methods: "POST" },

0 commit comments

Comments
 (0)