Skip to content

Commit e4dabe7

Browse files
committed
Accept truthy values for multiple claims.
1 parent bd8db7d commit e4dabe7

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

spec/v2/providers/https.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -577,14 +577,14 @@ describe("onCall", () => {
577577
const validResp = await runHandler(func, request({ auth: { pro: true, eap: true } }));
578578
expect(validResp.status).to.equal(200);
579579

580-
const missingResp = await runHandler(func, request({ auth: { pro: true } }));
581-
expect(missingResp.status).to.equal(403);
582-
583-
const wrongTypeResp = await runHandler(
580+
const truthyResp = await runHandler(
584581
func,
585-
request({ auth: { pro: "true", eap: "true" } })
582+
request({ auth: { pro: "true", eap: "abc" } })
586583
);
587-
expect(wrongTypeResp.status).to.equal(403);
584+
expect(truthyResp.status).to.equal(200);
585+
586+
const missingResp = await runHandler(func, request({ auth: { pro: true } }));
587+
expect(missingResp.status).to.equal(403);
588588

589589
const noClaimResp = await runHandler(func, request({ auth: {} }));
590590
expect(noClaimResp.status).to.equal(403);

src/v2/providers/https.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ export interface HttpsOptions extends Omit<GlobalOptions, "region" | "enforceApp
6161

6262
/** HTTP functions can override global options and can specify multiple regions to deploy to. */
6363
region?:
64-
| SupportedRegion
65-
| string
66-
| Array<SupportedRegion | string>
67-
| Expression<string>
68-
| ResetValue;
64+
| SupportedRegion
65+
| string
66+
| Array<SupportedRegion | string>
67+
| Expression<string>
68+
| ResetValue;
6969

7070
/** If true, allows CORS on requests to this function.
7171
* If this is a `string` or `RegExp`, allows requests from domains that match the provided value.
@@ -251,7 +251,7 @@ export function hasClaim(
251251
claimsToCheck[claimOrClaims] = value;
252252
} else if (Array.isArray(claimOrClaims)) {
253253
for (const claim of claimOrClaims) {
254-
claimsToCheck[claim] = true;
254+
claimsToCheck[claim] = undefined;
255255
}
256256
} else {
257257
claimsToCheck = claimOrClaims;

0 commit comments

Comments
 (0)