allow method specific middleware
This commit is contained in:
parent
1bb2421e9d
commit
df2d7a7ed5
@ -28,9 +28,9 @@ class Endpoint {
|
||||
|
||||
init () {
|
||||
|
||||
for (const [ method, cb ] of this.methods) {
|
||||
for (const [ method, cb, mw = [] ] of this.methods) {
|
||||
if (typeof method !== 'string') throw new Error(`Invalid method parameter type in Endpoint ${this.name} major path`);
|
||||
this.client.app[method](this.path, ...this.middleware, cb);
|
||||
this.client.app[method](this.path, ...this.middleware, ...mw, cb);
|
||||
}
|
||||
|
||||
this.subpaths = [ ...this._subpaths, ...this.subpaths ];
|
||||
|
Loading…
Reference in New Issue
Block a user