Default error response for other methods

Let’s say I have a lambda function to POST to a path as following:

    events:
    - http:
        path: /myPath
        method: post

how do I provide a default error message for non POST methods? When I make a GET on /myPath I get an ugly api gateway error.

You could change the method to any then have the Lambda respond with an error if the method isn’t post.

1 Like

thanks any is the answer i was looking for