Submitting a request with an invalid zipcode like /api/representatives/cat results in a 500 Internal Server Error, but should be a 400 Bad Request instead.
Expected Behavior
The requests below should result in the following status codes
/api/representatives/cat has a response of 400 Bad Request
/api/representatives/84014 has a response of 200 OK
/api/representatives/84014-1404 has a response of 200 OK
Current Behavior
Submitting a request with an invalid zipcode like /api/representatives/cat results in a 500 Internal Server Error, but should be a 400 Bad Request instead.
Possible Solution
Perform some zipcode validation in the /api/representatives/zipcode API and write some unit tests around the validation.
Steps to Reproduce
Start a codespace and run the server.
Access your API at /api/representatives/cat to see the 500 error.
Context (Environment)
I was wondering what zipcode formats are supported. I thought it would be good to build some validation around the zipcode format.
Labels
Functional Bug: something that is causing a crash of the app
Submitting a request with an invalid zipcode like
/api/representatives/cat
results in a500 Internal Server Error
, but should be a400 Bad Request
instead.Expected Behavior
The requests below should result in the following status codes
/api/representatives/cat
has a response of400 Bad Request
/api/representatives/84014
has a response of200 OK
/api/representatives/84014-1404
has a response of200 OK
Current Behavior
Submitting a request with an invalid zipcode like
/api/representatives/cat
results in a500 Internal Server Error
, but should be a400 Bad Request
instead.Possible Solution
Perform some zipcode validation in the
/api/representatives/zipcode
API and write some unit tests around the validation.Steps to Reproduce
/api/representatives/cat
to see the 500 error.Context (Environment)
I was wondering what zipcode formats are supported. I thought it would be good to build some validation around the zipcode format.
Labels