File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
aws_lambda_powertools/shared Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 17
17
EXEC_ENV : str = os .environ .get ("AWS_EXECUTION_ENV" , "NA" )
18
18
TARGET_SDK_EVENT : str = "request-created"
19
19
FEATURE_PREFIX : str = "PT"
20
- HEADER_NO_OP : str = f"{ FEATURE_PREFIX } /no-op/{ powertools_version } PTEnv/{ EXEC_ENV } "
20
+ DEFAULT_FEATURE : str = "no-op"
21
+ HEADER_NO_OP : str = f"{ FEATURE_PREFIX } /{ DEFAULT_FEATURE } /{ powertools_version } PTEnv/{ EXEC_ENV } "
21
22
22
23
23
24
def _initializer_botocore_session (session ):
24
25
try :
25
- session .user_agent_extra = HEADER_NO_OP
26
+ session .register ( TARGET_SDK_EVENT , _create_feature_function ( DEFAULT_FEATURE ))
26
27
except Exception :
27
28
logger .debug ("Can't add extra header User-Agent" )
28
29
@@ -37,7 +38,7 @@ def add_powertools_feature(request, **kwargs):
37
38
38
39
# This function is exclusive to client and resources objects created in Powertools
39
40
# and must remove the no-op header, if present
40
- if HEADER_NO_OP in headers ["User-Agent" ]:
41
+ if HEADER_NO_OP in headers ["User-Agent" ] and feature != DEFAULT_FEATURE :
41
42
# Remove HEADER_NO_OP + space
42
43
header_user_agent = header_user_agent .replace (f"{ HEADER_NO_OP } " , "" )
43
44
You can’t perform that action at this time.
0 commit comments