Added content-type check

This commit is contained in:
Alexander Cerutti
2023-07-30 00:18:32 +02:00
parent 0914d10701
commit 5895bb7ba0

View File

@@ -58,6 +58,14 @@ declare global {
export const pass = functions.https.onRequest( export const pass = functions.https.onRequest(
async (request: RequestWithBody, response) => { async (request: RequestWithBody, response) => {
if (request.headers["content-type"] !== "application/json") {
response.status(400);
response.send({
error: `Payload with content-type ${request.headers["content-type"]} is not supported. Use "application/json"`,
});
return;
}
if (!request.body.passModel) { if (!request.body.passModel) {
response.status(400); response.status(400);
response.send({ response.send({