Is this a valid POST request ? I am getting a 500 server error. However if I perform a GET request I can receive the default response.
SvelteKit page.sever.ts code:
TypeScript
const response = await fetch("http://<url>.appwrite.global/",
{
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(arrayIds),
});
Appwrite function code:
TypeScript
from appwrite.client import Client
import os
import json
def main(context):
if context.req.method == "POST":
return context.res.send("Response to a POST request")
return context.res.json({
"Response": "Default response",
})
TL;DR
Developers are getting a 500 server error when sending a POST request, but a GET request works fine. Check the code for the POST request function and make sure it's correct. Additionally, ensure the Appwrite function properly handles POST requests.Recommended threads
- Inviting members while SMTP is disabled ...
Issue: https://github.com/appwrite/console/issues/3125 PR: https://github.com/appwrite/console/pull/3126
- Appwrite Sites: ERR_TOO_MANY_REDIRECTS o...
So, my domain was working perfectly fine with Vercel. I was using cloudflare CDN (still am) but CNAME was DNS-only. I switched over to appwrite, CNAME is still ...
- Project restoration button in console
The project restore button in console is taking no effect, i have tried several times and still nothing, it gives same popup if i reload