Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
981 changes: 655 additions & 326 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -566,19 +566,19 @@
},
"dependencies": {
"@types/cors": "^2.8.5",
"@types/express": "^4.17.21",
"@types/express": "^5.0.6",
"cors": "^2.8.5",
"express": "^4.21.0",
"express": "^5.2.1",
"protobufjs": "^7.2.2"
},
"devDependencies": {
"@apollo/server": "^5.2.0",
"@as-integrations/express4": "^1.1.2",
"@as-integrations/express5": "^1.1.2",
"@eslint/eslintrc": "^3.3.1",
"@firebase/api-documenter": "^0.2.0",
"@microsoft/api-documenter": "^7.13.45",
"@microsoft/api-extractor": "^7.18.7",
"@types/chai": "^4.1.7",
"@types/chai": "^5.2.3",
"@types/chai-as-promised": "^7.1.0",
"@types/jsonwebtoken": "^9.0.0",
"@types/mocha": "^5.2.7",
Expand Down Expand Up @@ -622,15 +622,15 @@
},
"peerDependencies": {
"@apollo/server": "^5.2.0",
"@as-integrations/express4": "^1.1.2",
"@as-integrations/express5": "^1.1.2",
"graphql": "^16.12.0",
"firebase-admin": "^11.10.0 || ^12.0.0 || ^13.0.0"
},
"peerDependenciesMeta": {
"@apollo/server": {
"optional": true
},
"@as-integrations/express4": {
"@as-integrations/express5": {
"optional": true
},
"graphql": {
Expand Down
5 changes: 5 additions & 0 deletions spec/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export function runHandler(
return this.headers[name];
}

public sendStatus(code: number) {
this.status(code);
this.end();
}
Comment on lines +78 to +81
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The sendStatus implementation in MockResponse should ideally send the status code as the response body to match Express v5 behavior, e.g., this.send(code.toString()).

Suggested change
public sendStatus(code: number) {
this.status(code);
this.end();
}
public sendStatus(code: number) {
this.status(code);
this.send(code.toString());
}

Copy link
Copy Markdown
Author

@alexandercerutti alexandercerutti May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure about this.
.send shouldn't accept anymore the status in Express v5, so I change the mock as well to complete the request. (or, yes, make the code a string, but I'm not sure it still make sense)


public send(sendBody: any) {
if (this.writeCalled) {
throw Error("Cannot set headers after they are sent to the client");
Expand Down
4 changes: 2 additions & 2 deletions spec/v1/providers/https.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe("CloudHttpsBuilder", () => {
describe("#onRequest", () => {
it("should return a trigger with appropriate values", () => {
const result = https.onRequest((req, resp) => {
resp.send(200);
resp.sendStatus(200);
});
expect(result.__trigger).to.deep.equal({ httpsTrigger: {} });
expect(result.__endpoint).to.deep.equal({
Expand Down Expand Up @@ -77,7 +77,7 @@ describe("CloudHttpsBuilder", () => {
onInit(() => (hello = "world"));
expect(hello).to.be.undefined;
const fn = functions.https.onRequest((_req, res) => {
res.send(200);
res.sendStatus(200);
});
const req = new MockRequest(
{
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/providers/httpsAsync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("CloudHttpsBuilder async onRequest", () => {
it("should not log if handler completes successfully", async () => {
const fn = https.onRequest(async (_req, res) => {
await Promise.resolve();
res.send(200);
res.sendStatus(200);
});

const req = new MockRequest({}, {});
Expand Down
13 changes: 8 additions & 5 deletions spec/v2/providers/https.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { expectedResponseHeaders, MockRequest } from "../../fixtures/mockrequest
import { runHandler } from "../../helper";
import { FULL_ENDPOINT, MINIMAL_V2_ENDPOINT, FULL_OPTIONS, FULL_TRIGGER } from "./fixtures";
import { onInit } from "../../../src/v2/core";
import { Handler } from "express";
import { genkit } from "genkit";
import { clearParams, defineBoolean, defineList, Expression } from "../../../src/params";

Expand Down Expand Up @@ -72,7 +71,7 @@ describe("onRequest", () => {

it("should return a minimal trigger/endpoint with appropriate values", () => {
const result = https.onRequest((req, res) => {
res.send(200);
res.sendStatus(200);
});

expect(result.__trigger).to.deep.equal({
Expand All @@ -99,7 +98,7 @@ describe("onRequest", () => {
invoker: ["service-account1@", "service-account2@"],
},
(req, res) => {
res.send(200);
res.sendStatus(200);
}
);

Expand Down Expand Up @@ -137,7 +136,7 @@ describe("onRequest", () => {
invoker: "private",
},
(req, res) => {
res.send(200);
res.sendStatus(200);
}
);

Expand Down Expand Up @@ -643,7 +642,11 @@ describe("onCall", () => {
() => "HHGTG"
);

const cases: Array<{ fn: Handler; auth?: Record<string, string>; status: number }> = [
const cases: Array<{
fn: https.HttpsFunction;
auth?: Record<string, string>;
status: number;
}> = [
{ fn: anyValue, auth: { meaning: "42" }, status: 200 },
{ fn: anyValue, auth: { meaning: "43" }, status: 200 },
{ fn: anyValue, auth: { order: "66" }, status: 403 },
Expand Down
2 changes: 1 addition & 1 deletion spec/v2/providers/httpsAsync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("v2.https.onRequest async", () => {
it("should not log if handler completes successfully", async () => {
const fn = https.onRequest(async (_req, res) => {
await Promise.resolve();
res.send(200);
res.sendStatus(200);
});

const req = new MockRequest({}, {});
Expand Down
2 changes: 1 addition & 1 deletion src/v2/providers/dataconnect/graphql.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApolloServer } from "@apollo/server";
import { expressMiddleware } from "@as-integrations/express4";
import { expressMiddleware } from "@as-integrations/express5";
import express from "express";
import fs from "fs";
import type { GraphQLResolveInfo } from "graphql";
Expand Down