travis-ci
459 of 459 new or added lines in 7 files covered. (100.0%)
432 of 500 relevant lines covered (86.4%)
10.97 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✔ |