All files / src/HttpProviders BaseHttpProvider.js

0% Statements 0/15
0% Branches 0/7
0% Functions 0/6
0% Lines 0/15
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 28 29 30 31 32                                                               
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class BaseHttpProvider {
    constructor() {
        this._headers = [];
    }
    SetGlobalHeader(headerName, headerValue) {
        this._headers[headerName] = headerValue;
    }
    UnsetGlobalHeader(headerName) {
        if (this._headers[headerName]) {
            delete this._headers[headerName];
        }
    }
    Ajax(tReturnType, options, additionalHeaders = []) {
        const headers = options.headers || [];
        for (const key in this._headers) {
            headers[key] = this._headers[key];
        }
        additionalHeaders.forEach((h) => {
            headers[h.name] = h.value;
        });
        options.headers = headers;
        return this.ajaxInner(tReturnType, options);
    }
    Upload(tReturnType, File, options) {
        options.headers = options.headers || [];
        return this.uploadInner(tReturnType, File, options);
    }
}
exports.BaseHttpProvider = BaseHttpProvider;
//# sourceMappingURL=BaseHttpProvider.js.map