mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-03 14:46:37 -04:00
stop terminating unexpected request methods to api endpoints
This commit is contained in:
@ -17,9 +17,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
res.setHeader("Cache-Control", "private, no-cache, no-store, must-revalidate");
|
||||
res.setHeader("Pragma", "no-cache");
|
||||
|
||||
if (req.method !== "POST") {
|
||||
// 405 Method Not Allowed
|
||||
return res.status(405).end();
|
||||
// redirect GET requests to this endpoint to the contact form itself
|
||||
if (req.method === "GET") {
|
||||
return res.redirect(302, "/contact/");
|
||||
}
|
||||
|
||||
const { body } = req;
|
||||
|
@ -34,11 +34,6 @@ type SpotifyTrackSchema = {
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
try {
|
||||
if (req.method !== "GET") {
|
||||
// 405 Method Not Allowed
|
||||
return res.status(405).end();
|
||||
}
|
||||
|
||||
// let Vercel edge cache results for 5 mins
|
||||
res.setHeader("Cache-Control", "public, max-age=0, s-maxage=300, stale-while-revalidate");
|
||||
|
||||
|
Reference in New Issue
Block a user