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