Allowing only POST requests through

How do I allow only POST requests through the input or output?

Often webhooks are sent as POST requests. However, sometimes you might be getting other requests to this endpoint (GET, PATCH, etc.), to filter them out, create a function:

if r.RequestMethod ~= "POST" then 
    -- request is not important, don't forward it

And attach it to the output. Once added, POST requests will come through:

curl -X POST

while PUT, GET and other request method webhooks:

curl -X POST

will be filtered out:

Last updated