Passing header fields to Vault Component


I made a small change on the Vault code to allow passing additional header fields (In my case, I needed to send an Authentication token).

On the Uploader.prototype._xhrSend function, right after the request.open line:

    if (typeof this.config.headers !== 'undefined') {
        for (var headerItem in this.config.headers) {
            request.setRequestHeader(headerItem, this.config.headers[headerItem]);

This small code actually allows sending any kind of header information.

On the Vault initialization, you just need to add a “headers” object (Next to the params object, for instance).

Hope it helps someone!


Thank you for your suggestion.
I’ll send it to the dev team, so the similar solution may appear in the future updates.