Skip to content

Commit 9ce3d8d

Browse files
committed
chore(event_handler): move cookies to shared (cicular dependency)
1 parent 18599da commit 9ce3d8d

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

aws_lambda_powertools/event_handler/api_gateway.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
from typing import Any, Callable, Dict, List, Match, Optional, Pattern, Set, Tuple, Type, Union
1414

1515
from aws_lambda_powertools.event_handler import content_types
16-
from aws_lambda_powertools.event_handler.cookies import Cookie
1716
from aws_lambda_powertools.event_handler.exceptions import NotFoundError, ServiceError
1817
from aws_lambda_powertools.shared import constants
18+
from aws_lambda_powertools.shared.cookies import Cookie
1919
from aws_lambda_powertools.shared.functions import resolve_truthy_env_var_choice
2020
from aws_lambda_powertools.shared.json_encoder import Encoder
2121
from aws_lambda_powertools.utilities.data_classes import (
@@ -207,7 +207,7 @@ def _add_cache_control(self, cache_control: str):
207207

208208
def _compress(self):
209209
"""Compress the response body, but only if `Accept-Encoding` headers includes gzip."""
210-
self.response.headers["Content-Encoding"].append("gzip")
210+
self.response.headers["Content-Encoding"] = "gzip"
211211
if isinstance(self.response.body, str):
212212
logger.debug("Converting string response to bytes before compressing it")
213213
self.response.body = bytes(self.response.body, "utf-8")

aws_lambda_powertools/shared/headers_serializer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from collections import defaultdict
33
from typing import Any, Dict, List, Union
44

5-
from aws_lambda_powertools.event_handler.cookies import Cookie
5+
from aws_lambda_powertools.shared.cookies import Cookie
66

77

88
class BaseHeadersSerializer:

tests/e2e/event_handler/test_header_serializer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44
from requests import Request
55

6-
from aws_lambda_powertools.event_handler.cookies import Cookie
6+
from aws_lambda_powertools.shared.cookies import Cookie
77
from tests.e2e.utils import data_fetcher
88

99

0 commit comments

Comments
 (0)