Skip to content

Commit

Permalink
better error message when invoking local lambda server with incorrect…
Browse files Browse the repository at this point in the history
… http method (#157)

motivation: nicer error messages

changes: return 405 when using wrong http method on the lambda invocatoin endpoint (local debug server)
  • Loading branch information
tomerd committed Aug 6, 2020
1 parent 9ebc9dd commit f3c68d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/AWSLambdaRuntimeCore/Lambda+LocalServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ private enum LocalLambda {
Self.invocations.append(invocation)
}

// lambda invocation using the wrong http method
case (_, let url) where url.hasSuffix(self.invocationEndpoint):
self.writeResponse(context: context, status: .methodNotAllowed)

// /next endpoint is called by the lambda polling for work
case (.GET, let url) where url.hasSuffix(Consts.getNextInvocationURLSuffix):
// check if our server is in the correct state
Expand Down

0 comments on commit f3c68d6

Please sign in to comment.