travis-ci
298 of 298 new or added lines in 6 files covered. (100.0%)
387 of 449 relevant lines covered (86.19%)
10.37 hits per line
|
/**
|
6✔ |
|
* Helper to read the body from a request stream |
6✔ |
|
* @param {object} request the request |
6✔ |
|
* @param {Function} callback the callback |
6✔ |
|
*/ |
6✔ |
|
module.exports = function getBody (request, callback) { |
6✔ |
|
var body = '' |
6✔ |
|
|
6✔ |
|
request.on('error', function (err) { |
36✔ |
|
callback(err) |
× |
|
}) |
6✔ |
|
|
6✔ |
|
request.on('data', (chunk) => {
|
36✔ |
|
body += chunk |
× |
|
}) |
6✔ |
|
request.on('end', () => {
|
36✔ |
|
callback(null, body)
|
6✔ |
|
}) |
6✔ |
|
} |
6✔ |