From c308c7b2372945da84906967faf9449d23aa74f4 Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Mon, 14 Sep 2020 15:03:59 +0200 Subject: [PATCH] Disable safe headers by default in backport lambda --- README.md | 2 +- commands/backport_records.py | 2 +- tests/test_backport_records.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1e3c3782..2aa0e697 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ Environment config: - ``BACKPORT_RECORDS_DEST_COLLECTION``:collection id to copy records to (default: same as source collection) - ``REQUESTS_TIMEOUT_SECONDS``: Connection/Read timeout in seconds (default: ``2``) - ``REQUESTS_NB_RETRIES``: Number of retries before failing (default: ``4``) -- ``SAFE_HEADERS``: Add concurrency control headers to update requests (default: ``true``) +- ``SAFE_HEADERS``: Add concurrency control headers to update requests (default: ``false``) Example: diff --git a/commands/backport_records.py b/commands/backport_records.py index 007b79e2..2933c369 100644 --- a/commands/backport_records.py +++ b/commands/backport_records.py @@ -40,7 +40,7 @@ def backport_records(event, context, **kwargs): os.getenv("BACKPORT_RECORDS_DEST_COLLECTION", source_collection), ) safe_headers = event.get( - "safe_headers", config("SAFE_HEADERS", default=True, cast=bool) + "safe_headers", config("SAFE_HEADERS", default=False, cast=bool) ) if source_bucket == dest_bucket and source_collection == dest_collection: diff --git a/tests/test_backport_records.py b/tests/test_backport_records.py index e3447b5a..0cf9e87c 100644 --- a/tests/test_backport_records.py +++ b/tests/test_backport_records.py @@ -110,6 +110,7 @@ def test_outdated_records_are_overwritten(self): backport_records( event={ "server": self.server, + "safe_headers": True, "backport_records_source_auth": self.auth, "backport_records_source_bucket": self.source_bid, "backport_records_source_collection": self.source_cid,