Handle contact route with trailing slash
This commit is contained in:
parent
5fc57a36c9
commit
787256b5c6
1 changed files with 4 additions and 1 deletions
|
|
@ -151,7 +151,10 @@ const handleContact = async (request: Request, env: Env) => {
|
||||||
export default {
|
export default {
|
||||||
async fetch(request: Request, env: Env): Promise<Response> {
|
async fetch(request: Request, env: Env): Promise<Response> {
|
||||||
const url = new URL(request.url);
|
const url = new URL(request.url);
|
||||||
if (url.pathname === "/api/contact") {
|
if (
|
||||||
|
url.pathname === "/api/contact" ||
|
||||||
|
url.pathname === "/api/contact/"
|
||||||
|
) {
|
||||||
if (request.method !== "POST") {
|
if (request.method !== "POST") {
|
||||||
return jsonResponse(
|
return jsonResponse(
|
||||||
{ ok: false, error: "Method not allowed." },
|
{ ok: false, error: "Method not allowed." },
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue