JCMais / node-libcurl

libcurl bindings for Node.js
https://npmjs.org/package/node-libcurl
MIT License
660 stars 117 forks source link

fix(curly): use default content-type when there are no headers #410

Open liamdiprose opened 4 months ago

liamdiprose commented 4 months ago

When using a sftp:// url, this headers variable is an empty array, which breaks the Object.entries call.

This PR adds a bounds check so the default content-type will be chosen if the headers variable is empty.

I failed to get this to work with my vite-based project, something about 'exports not defined'. It does work if I manually patch the dist/ javascript. So, I'll leave the verification to you.

Thanks, Liam