目前默认是敏感大小写,怎么配置为不敏感呢?
回复 (4)
C
不能设置吗?有人知道吗?
Z
引用 chuanzai不能设置吗?有人知道吗?
@chuanzai 自己加个中间件啊!或者加个插件,将请求的path转成小写,router定义小写就可以了
来自酷炫的 CNodeMD
A
module.exports = app => {
const { router, controller } = app;
router.opts.sensitive = false;
router.get('/ABC', controller.home.index);
};
it('should GET /', () => {
return app.httpRequest()
.get('/Abc')
.expect('hi, egg')
.expect(200);
});
https://github.com/eggjs/egg-core/blob/master/lib/egg.js#L317
没有什么问题是看源码解决不了的,如果有,就多看一个库。
(下一位~
C
thanks
参与回复
登录后即可参与回复。登录