fix: require projectUrl for classify_st_url endpoint#44
Open
vee1e wants to merge 1 commit into
Open
Conversation
Previously, when no URL was provided to /api/classify_st_url, the endpoint returned HTTP 200 with an empty predictions array, which was confusing to API consumers. Now returns 400 Bad Request with a clear error message: 'Project URL is required for URL-based classification' This aligns with the endpoint name (URL-based classification) and provides immediate feedback when a required parameter is missing. Signed-off-by: vee1e <vermalucky2004@gmail.com>
217fc1b to
02f0b3c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The /api/classify_st_url endpoint was returning HTTP 200 with an empty predictions array when no projectUrl was provided, which is confusing to API consumers.
Before (Issue)
When making a request without a projectUrl:
Request:
Response (HTTP 200 OK):
Problems:
After (Fixed)
Same request now returns:
Response (HTTP 400 Bad Request):
Benefits:
Changes Made
In backend/app.py, the classify_st_url function:
The fix is minimal and focused on improving API usability through proper error handling.