Skip to content
Draft
Show file tree
Hide file tree
Changes from 6 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
3 changes: 1 addition & 2 deletions functions/src/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import cors from 'cors';
import { DecodedIdToken } from 'firebase-admin/auth';
import { onRequest, Request } from 'firebase-functions/v2/https';
import { Request, onRequest } from 'firebase-functions/v2/https';
import type { Response } from 'express';
import { StatusCodes } from 'http-status-codes';
import { getDecodedIdToken } from './common/auth';
Expand Down Expand Up @@ -123,7 +123,6 @@ export async function invokeCallbackAsync(
res,
user,
() => {
res.status(StatusCodes.OK).end();
Comment thread
rfontanarosa marked this conversation as resolved.
resolve(undefined);
},
(errorCode: number, message: string) => {
Expand Down
2 changes: 1 addition & 1 deletion functions/src/import-geojson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function importGeoJsonCallback(
await Promise.all(inserts);
const count = inserts.length;
console.debug(`${count} LOIs imported`);
res.send(JSON.stringify({ count }));
res.status(StatusCodes.OK).json({ count });
done();
} catch (err) {
console.debug(err);
Expand Down
2 changes: 2 additions & 0 deletions functions/src/testing/http-test-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function createResponseSpy(chunks?: string[]): Response<any> {
const res = jasmine.createSpyObj<Response<any>>('response', [
'send',
'status',
'json',
'end',
'write',
'type',
Expand All @@ -54,6 +55,7 @@ export function createResponseSpy(chunks?: string[]): Response<any> {
'removeListener',
]);
res.status.and.callThrough().and.returnValue(res);
res.json.and.callThrough().and.returnValue(res);
res.end.and.callThrough().and.returnValue(res);
res.write.and.callFake((chunk: any): boolean => {
chunks?.push(chunk.toString());
Expand Down
Loading