alexa-js / alexa-verifier-middleware

An express middleware that verifies HTTP requests sent to an Alexa skill are sent from Amazon.
MIT License
31 stars 6 forks source link

Issue #5: added else clause to prevent a second response from being sent #6

Closed strttn closed 7 years ago

strttn commented 7 years ago

The problem that I am fixing: If this middleware is being used and a request is sent that does not contain any signaturecertchainurl then the container.js file sends back a 401 response. However, the method continues to process and will then attempt to send a second 401 response, which causes an unhandled exception.

The fix: The fix is to add an "else" so that if the first part fails a check and sends a 401 it does not proceed with the second part of the method.

dblock commented 7 years ago

We really need some tests for this thing ... maybe this is a good opportunity?

mreinstein commented 7 years ago

fixed with https://github.com/alexa-js/alexa-verifier-middleware/commit/f284b6de23a459cc0039196d65fc678798abbc32

thanks for catching this issue!