INNER CODE UNIT · JavaScript
execute
astefanutti/kubebox · lib/client.js:85
function execute(request, { generator, readable, async, cancellable, rejectOnAbort }) {
const { client, client: { auth_provider }, authorization = true, token } = request.context;
const options = merge({}, client.master_api, request.options);
if (!authorization) {
delete options.headers['Authorization'];
} else if (token) {
options.headers['Authorization'] = `Bearer ${token}`;
}
let promise = Promise.resolve();
let cancellation = Function.prototype;
if (auth_provider && authorization && !token) {
const { promise: p, cancellation: c } = auth_provider.provideAuth(options);
promise = p;
cancellation = c;
}