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

Missing error handling for Content-type header #2

Open
Hugo1380 opened this issue Dec 18, 2024 · 0 comments
Open

Missing error handling for Content-type header #2

Hugo1380 opened this issue Dec 18, 2024 · 0 comments

Comments

@Hugo1380
Copy link

Hugo1380 commented Dec 18, 2024

For POST /dns/:hostname, if you haven't set `Content-Type: application/json' in the request.
You will get an error telling you that a list of IP addresses is required.
It may be more relevant to check if the Content-Type header is present/valid and return a missing header response or unsupported_media_type (code 415).

Example:

curl -X POST -d '{"ips": ["192.168.0.2"]}' 127.0.0.1:8080/dns/test2
{"error":"IP address list is required"}
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