Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library treats parameters equal to 0 as null and does not send them #14

Closed
DSpeichert opened this issue Aug 2, 2016 · 2 comments
Closed
Assignees

Comments

@DSpeichert
Copy link

I am executing the following call in order to add a firewall rule on the IP:

await ovh.requestPromised('POST', '/ip/' + encodeURIComponent(ipblock) + '/firewall/' + ip + '/rule', ruleObj);

Consider the following ruleObj:

ruleObj = {
    action: 'permit',
    destinationPort: null,
    protocol: 'udp',
    sequence: 0,
    source: '8.8.8.8/32',
    sourcePort: 53,
    tcpOption: null
};

This will fail with error: error=400, message=Missing sequence parameter while calling creation handler

However, when I use the following, it works!:

ruleObj = {
    action: 'permit',
    destinationPort: null,
    protocol: 'udp',
    sequence: new String(0),
    source: '8.8.8.8/32',
    sourcePort: 53,
    tcpOption: null
};

It seems like the ovh library is treating numeric 0 as null and not sending it, while a String of 0 is properly sent. Other numbers work as expected when sent as Numbers.

@bnjjj
Copy link
Contributor

bnjjj commented Aug 2, 2016

Thanks for your report ! I'll check that next week ! And keep you update

@bnjjj
Copy link
Contributor

bnjjj commented Aug 10, 2016

It's done in v2.0.1. Let me know if it's right for you too ! Thank you

@bnjjj bnjjj closed this as completed Aug 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants