Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
fix: return 404 for invalid URL's for consistency
Browse files Browse the repository at this point in the history
URL's that are invalid should return a 404, just like any other
invalid URL.

Closes #578
  • Loading branch information
bbangert committed Aug 18, 2016
1 parent cf3f197 commit de9dff4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ after_success:
notifications:
slack:
secure: LE+1Nelh5PLrb35LU6yJI1EV2LDVm4V90Tb+5LhUpeGrcfqr47HhMLMGXbBSnnjYPRLCiT75xog+oMN5eAF4VnZle4qza6Ue7G+YwRtGo/V0ud0i2zSUT557yXcr2QCYAzTKJVgetnxQNYvru/l1trdNZsRbsPUm1vexAjaX5yo=
addons:
hosts:
- travis.dev
2 changes: 1 addition & 1 deletion autopush/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ def test_with_key(self):

yield client.send_notification(
vapid=vapid,
status=400)
status=404)

yield self.shut_down(client)

Expand Down
2 changes: 1 addition & 1 deletion autopush/web/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def extract_subscription(self, d):
ckey_header=d["ckey_header"],
)
except (InvalidTokenException, InvalidToken):
raise InvalidRequest("invalid token", errno=102)
raise InvalidRequest("invalid token", status_code=404, errno=102)
return result

@validates_schema(skip_on_field_errors=True)
Expand Down
5 changes: 4 additions & 1 deletion docs/http.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ Unless otherwise specified, all calls return the following error codes:
- 400 - Bad Parameters

- errno 101 - Missing neccessary crypto keys
- errno 102 - Invalid URL endpoint
- errno 108 - Router type is invalid
- errno 110 - Invalid crypto keys specified
- errno 111 - Missing Required Header
Expand All @@ -103,6 +102,10 @@ Unless otherwise specified, all calls return the following error codes:

- errno 109 - Invalid authentication

- 404 - Not Found

- errno 102 - Invalid URL endpoint

- 410 - `{UAID}` or `{CHID}` not found

- errno 103 - Expired URL endpoint
Expand Down

0 comments on commit de9dff4

Please sign in to comment.