mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 18:25:24 +00:00
Added content-type check
This commit is contained in:
@@ -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({
|
||||||
|
|||||||
Reference in New Issue
Block a user