node-js-libs/curlrequest

Keys in the 'headers' options object must have uppercase first letter

jfrumar opened this issue · 3 comments

I got caught in this, but debugging I see from line 210 in index.js:

key = key.replace(/[_-]/g, ' ').split(' ').map(function (str) {
                if (str.length) {
                    str = str[0].toUpperCase() + str.substr(1);
                }
                return str;
            }).join('-');
            headers[key] = options.headers[key];

So if the key in your passed in options.headers object doesn't match the one that's output after this transformation, then it will be undefined when running curl.

Fixed in 0.5.1.

Awesome, thanks.

When will 0.5.1 be pushed to npm? Right now I still only see 0.5.0 as the most recent.

Whoops, thought I'd already pushed it. It's available now.