first commit
This commit is contained in:
27
grafana/dashboards/requests/node_modules/then-request/lib/ResponsePromise.js
generated
vendored
Normal file
27
grafana/dashboards/requests/node_modules/then-request/lib/ResponsePromise.js
generated
vendored
Normal file
@@ -0,0 +1,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;
|
||||
Reference in New Issue
Block a user