Skip to content

Commit

Permalink
Check response body for etag as well
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Gerstel <[email protected]>
  • Loading branch information
Timothy Gerstel committed Aug 25, 2021
1 parent 21f2840 commit c24340a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mock/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,13 @@ def dataset_contents(dataset):
member['records'] = request.get_data()['records']
else:
if dataset == "MOCK.ETAG":
request_data = request.get_json()
for data in global_datasets:
if data['name'] == "MOCK.ETAG":
print("data:", data)
if request_data and 'etag' in request_data:
if request_data['etag'] == data['etag']:
return {"msg": "etag match, successful write"}, 200

if request.headers.get('etag') != data['etag']:
return {"error": "etag mismatch"}, 400
else:
Expand Down

0 comments on commit c24340a

Please sign in to comment.