File tree 4 files changed +14
-2
lines changed
4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ def _application_header_value(application: dict) -> str:
19
19
20
20
def _base_headers (config ):
21
21
headers = {'Authorization' : config .sdk_key or '' ,
22
- 'User-Agent' : 'PythonClient/' + VERSION }
22
+ 'User-Agent' : 'PythonClient/' + VERSION ,
23
+ 'Accept-Encoding' : 'gzip'
24
+ }
23
25
24
26
app_value = _application_header_value (config .application )
25
27
if app_value :
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ def test_get_all_data_returns_data():
9
9
with start_server () as server :
10
10
config = Config (sdk_key = 'sdk-key' , base_uri = server .uri )
11
11
fr = FeatureRequesterImpl (config )
12
-
12
+
13
13
flags = { 'flag1' : { 'key' : 'flag1' } }
14
14
segments = { 'segment1' : { 'key' : 'segment1' } }
15
15
resp_data = { 'flags' : flags , 'segments' : segments }
@@ -31,6 +31,7 @@ def test_get_all_data_sends_headers():
31
31
req = server .require_request ()
32
32
assert req .headers ['Authorization' ] == 'sdk-key'
33
33
assert req .headers ['User-Agent' ] == 'PythonClient/' + VERSION
34
+ assert req .headers ['Accept-Encoding' ] == 'gzip'
34
35
assert req .headers .get ('X-LaunchDarkly-Wrapper' ) is None
35
36
assert req .headers .get ('X-LaunchDarkly-Tags' ) is None
36
37
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ def test_request_properties():
43
43
assert req .method == 'GET'
44
44
assert req .headers .get ('Authorization' ) == 'sdk-key'
45
45
assert req .headers .get ('User-Agent' ) == 'PythonClient/' + VERSION
46
+ assert req .headers ['Accept-Encoding' ] == 'gzip'
46
47
assert req .headers .get ('X-LaunchDarkly-Wrapper' ) is None
47
48
assert req .headers .get ('X-LaunchDarkly-Tags' ) is None
48
49
Original file line number Diff line number Diff line change @@ -479,6 +479,14 @@ def test_sdk_key_is_sent():
479
479
480
480
assert mock_http .request_headers .get ('Authorization' ) == 'SDK_KEY'
481
481
482
+ def test_default_headers_are_send ():
483
+ with DefaultTestProcessor () as ep :
484
+ ep .send_event (EventInputIdentify (timestamp , context ))
485
+ ep .flush ()
486
+ ep ._wait_until_inactive ()
487
+
488
+ assert mock_http .request_headers .get ('Accept-Encoding' ) == 'gzip'
489
+
482
490
def test_wrapper_header_not_sent_when_not_set ():
483
491
with DefaultTestProcessor () as ep :
484
492
ep .send_event (EventInputIdentify (timestamp , context ))
You can’t perform that action at this time.
0 commit comments