Skip to content

Commit 1dc06f1

Browse files
committed
Standardize version string from v{n} to gcfv{n}.
1 parent a6dbdb9 commit 1dc06f1

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

spec/common/providers/https.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async function runCallableTest(test: CallTest): Promise<any> {
5555
expect(data).to.deep.equal(test.expectedData);
5656
return test.callableFunction(data, context);
5757
},
58-
"v1"
58+
"gcfv1"
5959
);
6060

6161
const responseV1 = await runHandler(callableFunctionV1, test.httpRequest);

src/common/providers/https.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ export interface CallableOptions {
698698
export function onCallHandler<Req = any, Res = any>(
699699
options: CallableOptions,
700700
handler: v1CallableHandler | v2CallableHandler<Req, Res>,
701-
version: "v1" | "v2"
701+
version: "gcfv1" | "gcfv2"
702702
): (req: Request, res: express.Response) => Promise<void> {
703703
const wrapped = wrapOnCallHandler(options, handler, version);
704704
return (req: Request, res: express.Response) => {
@@ -719,7 +719,7 @@ function encodeSSE(data: unknown): string {
719719
function wrapOnCallHandler<Req = any, Res = any>(
720720
options: CallableOptions,
721721
handler: v1CallableHandler | v2CallableHandler<Req, Res>,
722-
version: "v1" | "v2"
722+
version: "gcfv1" | "gcfv2"
723723
): (req: Request, res: express.Response) => Promise<void> {
724724
return async (req: Request, res: express.Response): Promise<void> => {
725725
try {
@@ -737,7 +737,7 @@ function wrapOnCallHandler<Req = any, Res = any>(
737737
// The original monkey-patched code lived in the functionsEmulatorRuntime
738738
// (link: https://github.com/firebase/firebase-tools/blob/accea7abda3cc9fa6bb91368e4895faf95281c60/src/emulator/functionsEmulatorRuntime.ts#L480)
739739
// and was not compatible with how monorepos separate out packages (see https://github.com/firebase/firebase-tools/issues/5210).
740-
if (isDebugFeatureEnabled("skipTokenVerification") && version === "v1") {
740+
if (isDebugFeatureEnabled("skipTokenVerification") && version === "gcfv1") {
741741
const authContext = context.rawRequest.header(CALLABLE_AUTH_HEADER);
742742
if (authContext) {
743743
logger.debug("Callable functions auth override", {
@@ -784,7 +784,7 @@ function wrapOnCallHandler<Req = any, Res = any>(
784784
const acceptsStreaming = req.header("accept") === "text/event-stream";
785785
const data: Req = decode(req.body.data);
786786
let result: Res;
787-
if (version === "v1") {
787+
if (version === "gcfv1") {
788788
result = await (handler as v1CallableHandler)(data, context);
789789
} else {
790790
const arg: CallableRequest<Req> = {

src/v1/providers/https.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function _onCallWithOptions(
115115
cors: { origin: true, methods: "POST" },
116116
},
117117
fixedLen,
118-
"v1"
118+
"gcfv1"
119119
)
120120
);
121121

src/v2/providers/https.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ export function onCall<T = any, Return = any | Promise<any>>(
389389
consumeAppCheckToken: opts.consumeAppCheckToken,
390390
},
391391
fixedLen,
392-
"v2"
392+
"gcfv2"
393393
);
394394

395395
func = wrapTraceContext(func);

0 commit comments

Comments
 (0)