diff options
Diffstat (limited to 'api-src')
| -rw-r--r-- | api-src/createPaypalOrder.ts | 6 |
1 files changed, 6 insertions, 0 deletions
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<Order> = 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) { |
