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

POST & PUT API - Incorrect Status Parameter Handling #289

Open
mittalVaghela opened this issue Aug 14, 2024 · 0 comments · May be fixed by #290
Open

POST & PUT API - Incorrect Status Parameter Handling #289

mittalVaghela opened this issue Aug 14, 2024 · 0 comments · May be fixed by #290
Labels
bug Something isn't working

Comments

@mittalVaghela
Copy link

Description

In the Semantic Hub application, both the POST and PUT APIs include two query parameters: status and type. The status parameter is a required field, with valid values being DRAFT, RELEASED, STANDARDIZED, and DEPRECATED.

Current Behavior

If the status parameter is passed with a null or blank value in either the POST or PUT API, the API currently returns a 500 Internal Server Error.

Expected Behavior

  • Both APIs should return a 400 Bad Request error when the status parameter is null or blank.
  • The error message should be descriptive, indicating that the status parameter could not be null or blank. Example: "status could not be null or blank (i.e., DRAFT, RELEASED, STANDARDIZED, DEPRECATED)".

Steps To Reproduce

For POST API:

  • Make a POST request to the relevant API endpoint.
  • Pass a null or blank value for the status parameter.
  • Observe that the API returns a 500 Internal Server Error.

For PUT API:

  • Make a PUT request to the relevant API endpoint.
  • Pass a null or blank value for the status parameter.
  • Observe that the API returns a 500 Internal Server Error.

Proposed Solution:

Add validation to check the status parameter before processing the request in both POST and PUT APIs. If null or blank, the APIs should return a 400 Bad Request response with an appropriate error message.

@mittalVaghela mittalVaghela added the bug Something isn't working label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant