Comparing version
@@ -17,4 +17,5 @@ "use strict"; | ||
} | ||
// @ts-nocheck | ||
const initBridge = ({ routes, url, errorHandler, formidable, }) => new Bridge(routes, { formidable, errorHandler }, url || ''); | ||
exports.initBridge = initBridge; | ||
//# sourceMappingURL=bridge.js.map |
import { Method } from '../../routes'; | ||
import { AbstractHandler, Handler } from '../handler'; | ||
export declare class MethodValidator extends AbstractHandler { | ||
private method; | ||
constructor(method?: Method); | ||
private method?; | ||
constructor(method?: Method | undefined); | ||
handle: Handler['handle']; | ||
} | ||
//# sourceMappingURL=methodValidator.d.ts.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
method; | ||
constructor(method = 'POST') { | ||
constructor(method) { | ||
super(); | ||
@@ -14,5 +14,5 @@ this.method = method; | ||
handle = async (data) => { | ||
if (data.method === this.method) | ||
if (!this.method || data.method === this.method) | ||
return super.handle(data); | ||
return (0, error_1.httpError)(error_1.StatusCode.NOT_FOUND, 'Wrong method', { method: this.method }); | ||
return (0, error_1.httpError)(error_1.StatusCode.METHOD_NOT_ALLOWED, 'Wrong method', { method: this.method }); | ||
}; | ||
@@ -19,0 +19,0 @@ } |
{ | ||
"name": "bridge", | ||
"version": "2.0.12", | ||
"version": "2.0.13", | ||
"description": "Bridge is a new way of developing your api's", | ||
@@ -5,0 +5,0 @@ "author": "El Ouahabi Nabil", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
103754
0.08%1146
0.09%