(opts)
| 946 | } |
| 947 | |
| 948 | function createServer (opts) { |
| 949 | const _bodyParser = typeof opts !== 'function' |
| 950 | ? bodyParser.urlencoded(opts) |
| 951 | : opts |
| 952 | |
| 953 | return http.createServer(function (req, res) { |
| 954 | _bodyParser(req, res, function (err) { |
| 955 | if (err) { |
| 956 | res.statusCode = err.status || 500 |
| 957 | res.end('[' + err.type + '] ' + err.message) |
| 958 | } else { |
| 959 | res.statusCode = 200 |
| 960 | res.end(JSON.stringify(req.body) || typeof req.body) |
| 961 | } |
| 962 | }) |
| 963 | }) |
| 964 | } |
| 965 | |
| 966 | function expectKeyCount (count) { |
| 967 | return function (res) { |
no outgoing calls
no test coverage detected
searching dependent graphs…