1 |
|
2 |
|
3 |
|
4 | var methods = require('methods');
|
5 | var Test = require('./lib/test');
|
6 | var http = require('http');
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | module.exports = function(app) {
|
17 | var obj = {};
|
18 |
|
19 | if (typeof app === 'function') {
|
20 | app = http.createServer(app);
|
21 | }
|
22 |
|
23 | methods.forEach(function(method) {
|
24 | obj[method] = function(url) {
|
25 | return new Test(app, method, url);
|
26 | };
|
27 | });
|
28 |
|
29 |
|
30 | obj.del = obj.delete;
|
31 |
|
32 | return obj;
|
33 | };
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | module.exports.Test = Test;
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | module.exports.agent = require('./lib/agent');
|