Skip to content

Commit

Permalink
Fix protected routes requiring API key even if noAuth option is set
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrowan committed Oct 18, 2018
1 parent 018497d commit f96faf1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -482,7 +482,7 @@ class Offline {

// this.serverlessLog(protectedRoutes);
// Check for APIKey
if (_.includes(protectedRoutes, `${routeMethod}#${fullPath}`) || _.includes(protectedRoutes, `ANY#${fullPath}`)) {
if ((_.includes(protectedRoutes, `${routeMethod}#${fullPath}`) || _.includes(protectedRoutes, `ANY#${fullPath}`)) && !this.options.noAuth) {
const errorResponse = response => response({ message: 'Forbidden' }).code(403).type('application/json').header('x-amzn-ErrorType', 'ForbiddenException');
if ('x-api-key' in request.headers) {
const requestToken = request.headers['x-api-key'];
Expand Down

0 comments on commit f96faf1

Please sign in to comment.