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

Webapp: Fix error messages during upstream creation #36

Open
saarasio opened this issue Sep 17, 2019 · 0 comments
Open

Webapp: Fix error messages during upstream creation #36

saarasio opened this issue Sep 17, 2019 · 0 comments

Comments

@saarasio
Copy link
Owner

Note that when upstream_ip is not provided, the error message is - "No JSON object could be decoded". This is not very helpful.

[ec2-user@ip-172-31-18-10 enroute-cp]$ curl -s -X POST localhost:1323/upstream -H "Authorization: Bearer treehugger" -H "Content-Type: application/json" -d '{"Upstream_name":"db_serve_process", "upstream_hc_host":"127.0.0.1", "upstream_hc_path":"/v1/version", "upstream_port":"8081"}' | python -m json.tool
No JSON object could be decoded
[ec2-user@ip-172-31-18-10 enroute-cp]$ curl -s -X POST localhost:1323/upstream -H "Authorization: Bearer treehugger" -H "Content-Type: application/json" -d '{"Upstream_name":"db_serve_process", "upstream_hc_host":"127.0.0.1", "upstream_hc_path":"/v1/version", "upstream_port":"8081"}' | python -m json.tool
No JSON object could be decoded
[ec2-user@ip-172-31-18-10 enroute-cp]$ curl -s -X POST localhost:1323/upstream -H "Authorization: Bearer treehugger" -H "Content-Type: application/json" -d '{"Upstream_name":"db_serve_process", "upstream_ip":"127.0.0.1", "upstream_hc_path":"/v1/version", "upstream_port":"8081"}' | python -m json.tool
{
    "Error": "Please provide a valid weight value."
}
[ec2-user@ip-172-31-18-10 enroute-cp]$ curl -s -X POST localhost:1323/upstream -H "Authorization: Bearer treehugger" -H "Content-Type: application/json" -d '{"Upstream_name":"db_serve_process", "upstream_ip":"127.0.0.1", "upstream_hc_path":"/v1/version", "upstream_port":"8081", "upstream_weight":"98"}' | python -m json.tool
{
    "data": {
        "insert_saaras_db_upstream": {
            "affected_rows": 1
        }
    }
}
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

1 participant