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

Add toString to req.body.ID of consul.agent.service.register #31

Closed
wants to merge 1 commit into from

Conversation

Sayalic0
Copy link

consul.agent.service.register({
    "name": "casperx-manager",
    "id": 9939, // <= an interger
    "port": 9939,
    "address": "127.0.0.1",
    "check": {
        "http": "http://localhost:" + 9939 + "/health",
        "interval": "5s"
    }
}, function (err) {
    if (err) {
        console.log(err);
        throw err;
    }
});

That will result a 400 bad request, because consul require a String id. So I add toString() to make sure req.body.ID is a String.

@Sayalic0 Sayalic0 changed the title add toString to option id Add toString to req.body.ID of consul.agent.service.register Apr 20, 2016
@silas
Copy link
Owner

silas commented Aug 30, 2016

Thanks for the PR, but I'd prefer if people just normalize options before calling consul. Implicitly coercing data generally causes more problems than it solves (at least in my experience).

Thanks again!

@silas silas closed this Aug 30, 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

Successfully merging this pull request may close these issues.

2 participants