node-js-libs / curlrequest

A cURL wrapper
MIT License
184 stars 44 forks source link

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

Closed jfrumar closed 10 years ago

jfrumar commented 10 years ago

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.

chriso commented 10 years ago

Fixed in 0.5.1.

jfrumar commented 10 years ago

Awesome, thanks.

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

chriso commented 10 years ago

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