mirror of
https://github.com/Wessel/wumpfetch.git
synced 2026-07-04 13:41:59 +02:00
Add most common used methods (w.get, w.post, w.patch, etc.)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user