Real-Dev-Squad / discord-slash-commands

MIT License
4 stars 21 forks source link

handling post request for API #152

Open vinayak-trivedi opened 10 months ago

vinayak-trivedi commented 10 months ago

Previously we had the following code written in our index.js which was restricting us to create post request API:



if (request.method === "POST") {
  const isVerifiedRequest = await verifyBot(request, env);
  if (!isVerifiedRequest) {
    console.error("Invalid Request");
    return new JSONResponse(response.BAD_SIGNATURE, { status: 401 });
  }
}

[this PR](https://github.com/Real-Dev-Squad/discord-slash-commands/pull/130) solved that issue for us, we can just add the endpoint of the APi to the array, and then we will be able to create the API which have post method

but this is not an ideal situation for us, as this can lead to a long list of endpoint being added to that array, we need to find a better solution for this
ajoykumardas12 commented 9 months ago

I will take this task. Providing ETA soon.