Skip to content

Conversation

@finnshort
Copy link
Contributor

Adds validation to bounding box input by user when downloading json data. Previously, an error parsing or using the bounding box params would result in a 500 error. Now server returns a more useful error message with status code 400 (bad request).

Example test:
bikemaps.org/incidents.json?bbox="-123.3,49.0,-122.7,49.3"

Opening a PR for review but pushing this branch to prod as a hotfix in the meantime.

@finnshort finnshort requested a review from dgboss July 8, 2023 01:19
def get(self, request, format=None):
try:
# Extract bounding box Url parameter
bbstr = request.GET.get('bbox', '-180,-90,180,90')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider pulling this out into a small helper function to reduce code duplication.

Copy link
Contributor

@dgboss dgboss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a suggestion to factor out a helper function.

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

Successfully merging this pull request may close these issues.

3 participants