wzp
2021-05-13 7d694a9113118daec5be7ac224dab46a3b20f106
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"use strict";
exports.__esModule = true;
var Promise = require("promise");
function getBody(encoding) {
    if (!encoding) {
        return this.then(getBodyBinary);
    }
    if (encoding === 'utf8') {
        return this.then(getBodyUTF8);
    }
    return this.then(getBodyWithEncoding(encoding));
}
function getBodyWithEncoding(encoding) {
    return function (res) { return res.getBody(encoding); };
}
function getBodyBinary(res) {
    return res.getBody();
}
function getBodyUTF8(res) {
    return res.getBody('utf8');
}
function toResponsePromise(result) {
    result.getBody = getBody;
    return result;
}
exports["default"] = toResponsePromise;
exports.ResponsePromise = undefined;