From 4a5bd8bf5e3c6017794d7c5c7eb4f2794a902245 Mon Sep 17 00:00:00 2001 From: Joe Carstairs <65492573+Sycamost@users.noreply.github.com> Date: Tue, 8 Aug 2023 08:07:28 +0100 Subject: Revert "Doesn't insist on POST" This reverts commit 84adcb14af7a0e13549f1977a2a5690e978fcf57. --- api-src/createPaypalOrder.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'api-src') diff --git a/api-src/createPaypalOrder.ts b/api-src/createPaypalOrder.ts index 0ae9f8f..676d788 100644 --- a/api-src/createPaypalOrder.ts +++ b/api-src/createPaypalOrder.ts @@ -5,6 +5,12 @@ import { paypalCreateOrder } from './_paypal'; export default async function handler(request: VercelRequest, response: VercelResponse) { const { productDescription, shortDescription, totalPrice }: Partial = request.body; + if (request.method !== 'POST') { + console.warn('Method was not POST. Method was ' + request.method); + response.status(404); + return; + } + if (!productDescription) { response.status(400).send('Expected body to contain productDescription, but none provided.'); } else if (!shortDescription) { -- cgit v1.2.3