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.

Hello, Juan./

Today we’ve released the dhtmlxVault 4.0, where we have finally added the possibility to add the custom headers to the uploading request.
Now you can add it with the headerParams property:
https://docs.dhtmlx.com/vault/api__uploader__headerparams_config.html