Comments (2)
I also ran into the problem of using "encoding = null". It turns out that the problem starts within the "copy" function within index.js. When the object copier finds a property that's assigned to null, it replaces it with an empty object. Thus, "encoding = null" becomes "encoding = {}"
Here's one possible solution to that problem:
exports.copy = function (obj) {
var copy = {};
for (var i in obj) {
if (typeof obj[i] === 'object') {
// handle properties that are set to null
copy[i] = (obj[i] === null) ? null : exports.copy(obj[i]);
} else {
copy[i] = obj[i];
}
}
return copy;
};
The next problem is that it now throws a different error: Failed to initialize.
This is because curl is now receiving the command line arguments --encoding null, due to the way the args are processed/composed, and can be fixed like this:
values.forEach(function (value) {
// don't send a flag for null values
if (value !== null) {
args.push('--' + key);
if (true !== value) {
args.push(value);
}
}
});
This library is exceptionally handy, and I'd love to see it continue to improve!
from curlrequest.
I've just pushed 0.4.1
which should fix the issue
from curlrequest.
Related Issues (20)
- curl_path
- --request "VERB" is insufficient for certain HTTP methods (head) HOT 1
- How can I use proxy HOT 1
- No data returned when remote file exceeds certain size HOT 1
- Downloading a file
- options.curl_path not implemented
- request return with 400 "bad request" HOT 1
- How can i able to "sets content type to application/json and sends request body as JSON string, instead of a query string" ?
- Downloading ascii vs binary files? HOT 1
- How do you use the process option?
- Uncaught Error: spawn curl ENOENT at exports._errnoException
- upload file usinng username pass
- Error when sending lots of data in body HOT 1
- Provide response code
- spawn curl ENOENT AWS Lambda HOT 1
- Security Notice & Bug Bounty - Command Injection - huntr.dev HOT 1
- Security Notice & Bug Bounty - Arbitrary File Read - huntr.dev HOT 2
- interface option
- getting error Uncaught (in promise) TypeError: Cannot read property 'apply' of undefined HOT 1
- Security Issue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from curlrequest.