Skip to content

Commit f3c68d6

Browse files
authored
better error message when invoking local lambda server with incorrect http method (#157)
motivation: nicer error messages changes: return 405 when using wrong http method on the lambda invocatoin endpoint (local debug server)
1 parent 9ebc9dd commit f3c68d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/AWSLambdaRuntimeCore/Lambda+LocalServer.swift

+4
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ private enum LocalLambda {
149149
Self.invocations.append(invocation)
150150
}
151151

152+
// lambda invocation using the wrong http method
153+
case (_, let url) where url.hasSuffix(self.invocationEndpoint):
154+
self.writeResponse(context: context, status: .methodNotAllowed)
155+
152156
// /next endpoint is called by the lambda polling for work
153157
case (.GET, let url) where url.hasSuffix(Consts.getNextInvocationURLSuffix):
154158
// check if our server is in the correct state

0 commit comments

Comments
 (0)