Add most common used methods (w.get, w.post, w.patch, etc.)

This commit is contained in:
Wessel T
2019-02-19 19:13:17 +01:00
parent e2cf4b5056
commit dd20fe8ab5
4 changed files with 44 additions and 20 deletions

View File

@@ -1,5 +1,14 @@
const { join } = require('path');
const common = [ 'GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH' ];
const request = require(join(__dirname, 'model', 'WumpRequest.js'));
module.exports = (url, method) => {
return new(require(join( __dirname, 'model', 'WumpRequest.js')))(url, method);
return new request(url, method);
};
common.forEach((v) => {
module.exports[v.toLowerCase()] = (url, method = v) => {
return new request(url, method);
}
});