Skip to content

Commit

Permalink
fix [Feature]: 支持禁用HTTP METHOD #7018
Browse files Browse the repository at this point in the history
  • Loading branch information
baozhoutao committed Sep 29, 2024
1 parent a81f849 commit 616c3eb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions services/service-steedos-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ module.exports = {
});
connectHandlersExpress.use(require('@steedos/router').staticRouter());
connectHandlersExpress.use(SteedosApi.express());
if(process.env.STEEDOS_HTTP_DISABLE_METHOD){
WebApp.connectHandlers.use((req, res, next) => {
if (_.split(process.env.STEEDOS_HTTP_DISABLE_METHOD).includes(req.method)){
res.statusCode = 405;
return res.end('Method Not Allowed')
}
return next()
});
}

WebApp.connectHandlers.use(connectHandlersExpress)
const steedosSchema = require('@steedos/objectql').getSteedosSchema(this.broker);
this.wrapAsync(this.startStandardObjectsPackageLoader, {});
Expand Down

0 comments on commit 616c3eb

Please sign in to comment.