Closed helje5 closed 4 years ago
Following https://fabianfett.de/swift-on-aws-lambda-creating-your-first-http-endpoint, there is the section about curl + 404:
curl -i http://localhost:7000/invoke
gives
HTTP/1.1 404 Not Found
Which seems to be triggered by the default branch in processRequest(context:request:):
processRequest(context:request:)
// unknown call default: self.writeResponse(context: context, status: .notFound)
I think this should be:
I'd suggest to switch on the url at the top level, and then within do the necessary guard for a resource, like:
case url.hasSuffix(Consts.postResponseURLSuffix): guard method == .POST else { return self.writeResponse(context: context, status: .methodNotAllowed) }
thanks for reporting @helje5, imo your proposal makes sense. @fabianfett wdyt?
@tomerd I think this should be solved with the better testing facilities (two port solution).
Following https://fabianfett.de/swift-on-aws-lambda-creating-your-first-http-endpoint, there is the section about curl + 404:
gives
Which seems to be triggered by the default branch in
processRequest(context:request:)
:I think this should be:
I'd suggest to switch on the url at the top level, and then within do the necessary guard for a resource, like: