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