Giter VIP home page Giter VIP logo

Comments (2)

panurgy avatar panurgy commented on June 12, 2024

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.

chriso avatar chriso commented on June 12, 2024

I've just pushed 0.4.1 which should fix the issue

from curlrequest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.