Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
Merge pull request #76 from mozilla-services/fix-if-none-match-header
Browse files Browse the repository at this point in the history
Fix If-None-Match header format.
  • Loading branch information
Natim committed Jan 12, 2016
2 parents cdd0d4d + 4a973b1 commit 8288faf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/api/resource.rst
Expand Up @@ -288,7 +288,7 @@ only endpoint that you can use either to create new record or to
update them.

If you want to make sure that you don't erase an existing record when
creating one, you can use the ``If-None-Match: "*"`` header value.
creating one, you can use the ``If-None-Match: *`` header value.

The PUT response body is a JSON mapping containing:

Expand Down
3 changes: 1 addition & 2 deletions syncto/headers.py
Expand Up @@ -18,7 +18,6 @@ def import_headers(syncto_request, sync_request_headers=None):
headers['User-Agent'] = ua

# Handle concurrency control.

if 'If-Match' in request_headers:
if_match = request_headers['If-Match']
try:
Expand All @@ -36,7 +35,7 @@ def import_headers(syncto_request, sync_request_headers=None):

if 'If-None-Match' in request_headers:
if_none_match = request_headers['If-None-Match']
if if_none_match == '"*"':
if if_none_match == '*':
headers['X-If-Unmodified-Since'] = 0
else:
try:
Expand Down
2 changes: 1 addition & 1 deletion syncto/tests/test_functional.py
Expand Up @@ -424,7 +424,7 @@ def test_can_put_valid_record(self):

def test_put_record_handles_if_none_match_headers(self):
headers = self.headers.copy()
headers['If-None-Match'] = '"*"'
headers['If-None-Match'] = '*'

self.app.put_json(RECORD_URL, RECORD_EXAMPLE,
headers=headers, status=200)
Expand Down

0 comments on commit 8288faf

Please sign in to comment.