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

Should it send an HTTP Status 500 if the connection to VMware env fails? #11

Open
jkilzi opened this issue Sep 8, 2024 · 3 comments
Open

Comments

@jkilzi
Copy link
Contributor

jkilzi commented Sep 8, 2024

PTAL here. Maybe the user sent an invalid URL? In that case a status of 422 (Unprocessable Entity) would be more appropriate.
In general it would be great to test first if the URL is reachable and fail fast otherwise. This can be done as part of the validations made to the Credentials payload. Also it could check if the credentials are rejected and then return a status code of 401.
WDYT?

@chenyosef
Copy link

An invalid URL can return even a bad request (401), but 422 may also works. I agree that 500 is the wrong error code in this case

@jkilzi
Copy link
Contributor Author

jkilzi commented Sep 8, 2024

An invalid URL is not a bad request (400). It is just an invalid value for a mandatory field, that's why I suggest using status 422 in this case. Regarding 401 (Unauthorized), that's the status that should be returned in case the credentials are rejected.
In general, status 400 would be suitable when the client sends a malformed payload (e.g. omits the username, that is a mandatory field)

@avishayt
Copy link
Contributor

avishayt commented Sep 9, 2024

We can do 422 for an invalid URL.

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

3 participants