Skip to content

Commit

Permalink
Regression: Fix API tests #13625
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego authored Mar 6, 2019
1 parent 76b5f7f commit 02c6312
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/rocketchat-api/server/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ class APIClass extends Restivus {
let shouldVerifyPermissions;

if (!_.isArray(options.permissionsRequired)) {
logger.warn('Invalid value for permissionsRequired');
options.permissionsRequired = undefined;
shouldVerifyPermissions = false;
} else {
Expand Down Expand Up @@ -539,6 +538,9 @@ const createApi = function _createApi(enableCors) {
}
};

// also create the API immediately
createApi(!!settings.get('API_Enable_CORS'));

// register the API to be re-created once the CORS-setting changes.
settings.get('API_Enable_CORS', (key, value) => {
createApi(value);
Expand All @@ -553,6 +555,3 @@ settings.get('API_Enable_Rate_Limiter_Limit_Calls_Default', (key, value) => {
defaultRateLimiterOptions.numRequestsAllowed = value;
API.v1.reloadRoutesToRefreshRateLimiter();
});

// also create the API immediately
createApi(!!settings.get('API_Enable_CORS'));

0 comments on commit 02c6312

Please sign in to comment.