Added early termination if passModel is not specified

This commit is contained in:
Alexander Cerutti
2023-07-30 00:11:02 +02:00
parent 2a4e21ac12
commit 0b439d299e

View File

@@ -58,6 +58,15 @@ declare global {
export const pass = functions.https.onRequest( export const pass = functions.https.onRequest(
async (request: RequestWithBody, response) => { async (request: RequestWithBody, response) => {
if (!request.body.passModel) {
response.status(400);
response.send({
error: "Unspecified 'passModel' parameter: which model should be used?",
});
return;
}
const newPass = await PKPass.from( const newPass = await PKPass.from(
{ {
// Get relevant pass model from model folder (see passkit-generator/examples/models/) // Get relevant pass model from model folder (see passkit-generator/examples/models/)