Skip to content

Commit fe8a030

Browse files
committed
Fix formatting issues.
1 parent e1b6833 commit fe8a030

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

spec/common/providers/https.spec.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -811,14 +811,13 @@ describe("onCallHandler", () => {
811811
{ accept: "text/event-stream" }
812812
) as any;
813813

814-
815814
const fn = https.onCallHandler(
816815
{
817816
cors: { origin: true, methods: "POST" },
818817
},
819-
async (req, resp) => {
818+
(req, resp) => {
820819
resp.write("initial message");
821-
mockReq.emit('close');
820+
mockReq.emit("close");
822821
resp.write("should not be sent");
823822
return "done";
824823
},
@@ -852,18 +851,18 @@ describe("onCallHandler", () => {
852851
const fn = https.onCallHandler(
853852
{
854853
cors: { origin: true, methods: "POST" },
855-
heartbeatSeconds: 5
854+
heartbeatSeconds: 5,
856855
},
857856
async () => {
858857
// Simulate long-running operation
859-
await new Promise(resolve => setTimeout(resolve, 11_000));
858+
await new Promise((resolve) => setTimeout(resolve, 11_000));
860859
return "done";
861860
},
862861
"gcfv2"
863862
);
864863

865864
const handlerPromise = runHandler(fn, mockReq as any);
866-
await clock.tickAsync(11_000)
865+
await clock.tickAsync(11_000);
867866
const resp = await handlerPromise;
868867
expect(resp.body).to.include(': ping\n: ping\ndata: {"result":"done"}');
869868
});
@@ -879,10 +878,10 @@ describe("onCallHandler", () => {
879878
const fn = https.onCallHandler(
880879
{
881880
cors: { origin: true, methods: "POST" },
882-
heartbeatSeconds: null
881+
heartbeatSeconds: null,
883882
},
884883
async () => {
885-
await new Promise(resolve => setTimeout(resolve, 31_000));
884+
await new Promise((resolve) => setTimeout(resolve, 31_000));
886885
return "done";
887886
},
888887
"gcfv2"

spec/helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function runHandler(
5353
private callback: () => void;
5454

5555
constructor() {
56-
request.on("close", () => this.end())
56+
request.on("close", () => this.end());
5757
}
5858

5959
public status(code: number) {

src/common/providers/https.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ export interface CallableOptions {
713713
*
714714
* Defaults to 30 seconds.
715715
*/
716-
heartbeatSeconds?: number | null
716+
heartbeatSeconds?: number | null;
717717
}
718718

719719
/** @internal */
@@ -752,9 +752,9 @@ function wrapOnCallHandler<Req = any, Res = any>(
752752
clearInterval(heartbeatInterval);
753753
heartbeatInterval = null;
754754
}
755-
}
755+
};
756756

757-
req.on('close', () => {
757+
req.on("close", () => {
758758
clearHeartbeatInterval();
759759
abortController.abort();
760760
});
@@ -832,27 +832,24 @@ function wrapOnCallHandler<Req = any, Res = any>(
832832
write(chunk): boolean {
833833
// if client doesn't accept sse-protocol, response.write() is no-op.
834834
if (!acceptsStreaming) {
835-
return false
835+
return false;
836836
}
837837
// if connection is already closed, response.write() is no-op.
838838
if (abortController.signal.aborted) {
839-
return false
839+
return false;
840840
}
841841
const formattedData = encodeSSE({ message: chunk });
842842
return res.write(formattedData);
843843
},
844844
acceptsStreaming,
845-
signal: abortController.signal
845+
signal: abortController.signal,
846846
};
847847
if (acceptsStreaming) {
848848
// SSE always responds with 200
849849
res.status(200);
850850
const heartbeatSeconds = options.heartbeatSeconds ?? DEFAULT_HEARTBEAT_SECONDS;
851851
if (heartbeatSeconds !== null && heartbeatSeconds > 0) {
852-
heartbeatInterval = setInterval(
853-
() => res.write(": ping\n"),
854-
heartbeatSeconds * 1000
855-
);
852+
heartbeatInterval = setInterval(() => res.write(": ping\n"), heartbeatSeconds * 1000);
856853
}
857854
}
858855
// For some reason the type system isn't picking up that the handler

src/v2/providers/https.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export interface CallableOptions extends HttpsOptions {
205205
*
206206
* Defaults to 30 seconds.
207207
*/
208-
heartbeatSeconds?: number | null
208+
heartbeatSeconds?: number | null;
209209
}
210210

211211
/**

0 commit comments

Comments
 (0)