Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _handle_stale_expected(request):

# Check if client is trying to go back in time, return 400 response
if qs_expected > 0 and qs_expected < qs_since:
response = httpexceptions.HTTPNoContent()
response = httpexceptions.HTTPBadRequest()
Copy link
Contributor

Choose a reason for hiding this comment

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

See changes of #982

Suggested change
response = httpexceptions.HTTPBadRequest()
raise_invalid(
request,
name="_expected",
location="querystring",
description="`_expected` parameter cannot be lower than `_since`",

cache_seconds = int(
request.registry.settings.get(
"changes.since_max_age_redirect_ttl_seconds", 86400
Expand Down
6 changes: 4 additions & 2 deletions kinto-remote-settings/tests/changes/test_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,10 @@ def test_redirects_and_drops_since_if_too_old(self):
assert resp.status_code == 307

def test_bad_request_if_rewind(self):
resp = self.app.get(self.changes_uri + "?_since=42&_expected=1")
assert resp.status_code == 204
resp = self.app.get(
self.changes_uri + "?_since=42&_expected=1", expect_errors=True
)
assert resp.status_code == 400

def test_redirects_keep_other_querystring_params(self):
resp = self.app.get(self.changes_uri + "?_since=42&_foo=%22123456%22")
Expand Down
4 changes: 2 additions & 2 deletions kinto-remote-settings/tests/changes/test_changeset.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ def test_changeset_redirects_if_since_is_too_old(self):
)

def test_changeset_bad_request_if_rewind(self):
resp = self.app.get(self.changeset_uri + '&_since="43"')
assert resp.status_code == 204
resp = self.app.get(self.changeset_uri + '&_since="43"', expect_errors=True)
assert resp.status_code == 400

def test_limit_is_supported(self):
resp = self.app.get(self.changeset_uri + "&_limit=1", headers=self.headers)
Expand Down
Loading