20
20
check_secure_default_shotgun_stream_endpoint /1 ,
21
21
check_secure_default_httpc_poll_endpoint /1 ,
22
22
check_secure_default_httpc_events_endpoint /1 ,
23
- check_secure_default_shotgun_invalid /1
23
+ check_secure_default_shotgun_invalid /1 ,
24
+ check_secure_default_shotgun_stream_endpoint_federal /1 ,
25
+ check_secure_default_httpc_poll_endpoint_federal /1 ,
26
+ check_secure_default_httpc_events_endpoint_federal /1
24
27
]).
25
28
26
29
% %====================================================================
@@ -38,7 +41,10 @@ all() ->
38
41
check_secure_default_shotgun_stream_endpoint ,
39
42
check_secure_default_httpc_poll_endpoint ,
40
43
check_secure_default_httpc_events_endpoint ,
41
- check_secure_default_shotgun_invalid
44
+ check_secure_default_shotgun_invalid ,
45
+ check_secure_default_shotgun_stream_endpoint_federal ,
46
+ check_secure_default_httpc_poll_endpoint_federal ,
47
+ check_secure_default_httpc_events_endpoint_federal
42
48
].
43
49
44
50
init_per_suite (Config ) ->
@@ -58,7 +64,7 @@ end_per_testcase(_, _Config) ->
58
64
% % Helpers
59
65
% %====================================================================
60
66
61
- open_stream (Uri , HttpOptions ) ->
67
+ open_stream (Uri , HttpOptions , SdkKeyEnv ) ->
62
68
GunOpts = ldclient_http_options :gun_parse_http_options (HttpOptions ),
63
69
Opts = #{gun_opts => GunOpts },
64
70
{ok , {Scheme , Host , Port , Path , Query }} = ldclient_http :uri_parse (Uri ),
@@ -84,7 +90,7 @@ open_stream(Uri, HttpOptions) ->
84
90
end ,
85
91
Options = #{async => true , async_mode => sse , handle_event => F },
86
92
Headers = #{
87
- " authorization" => os :getenv (" LD_SDK_KEY " ),
93
+ " authorization" => os :getenv (SdkKeyEnv ),
88
94
<<" user-agent" >> => ldclient_config :get_user_agent ()
89
95
},
90
96
case shotgun :get (Pid , Path ++ Query , Headers , Options ) of
@@ -105,7 +111,14 @@ check_secure_default_shotgun_stream_endpoint(_) ->
105
111
tls_options => ldclient_config :tls_basic_options (),
106
112
connect_timeout => undefined ,
107
113
custom_headers => undefined
108
- }).
114
+ }, " LD_SDK_KEY" ).
115
+
116
+ check_secure_default_shotgun_stream_endpoint_federal (_ ) ->
117
+ {ok , _ } = open_stream (" https://stream.launchdarkly.us/all" , #{
118
+ tls_options => ldclient_config :tls_basic_options (),
119
+ connect_timeout => undefined ,
120
+ custom_headers => undefined
121
+ }, " LD_FED_SDK_KEY" ).
109
122
110
123
check_secure_default_httpc_poll_endpoint (_ ) ->
111
124
Options = [{ssl , ldclient_config :tls_basic_options ()}],
@@ -114,6 +127,13 @@ check_secure_default_httpc_poll_endpoint(_) ->
114
127
{" User-Agent" , ldclient_config :get_user_agent ()}
115
128
]}, Options , []).
116
129
130
+ check_secure_default_httpc_poll_endpoint_federal (_ ) ->
131
+ Options = [{ssl , ldclient_config :tls_basic_options ()}],
132
+ {ok , _ } = httpc :request (get , {" https://sdk.launchdarkly.us/sdk/latest-all" , [
133
+ {" Authorization" , os :getenv (" LD_FED_SDK_KEY" )},
134
+ {" User-Agent" , ldclient_config :get_user_agent ()}
135
+ ]}, Options , []).
136
+
117
137
check_secure_default_httpc_events_endpoint (_ ) ->
118
138
Options = [{ssl , ldclient_config :tls_basic_options ()}],
119
139
{ok , _ } = httpc :request (post , {" https://events.launchdarkly.com/bulk" , [
@@ -124,6 +144,16 @@ check_secure_default_httpc_events_endpoint(_) ->
124
144
<<" [{\" endDate\" :1634839284004,\" features\" :{\" test-boolean-flag\" :{\" counters\" :[{\" count\" :1,\" unknown\" :false,\" value\" :true,\" variation\" :0,\" version\" :1}],\" default\" :\" default-value\" }},\" kind\" :\" summary\" ,\" startDate\" :1634839284004},{\" creationDate\" :1634839284004,\" kind\" :\" index\" ,\" user\" :{\" firstName\" :\" Tester\" ,\" key\" :\" 12345-track\" ,\" lastName\" :\" Testerson\" ,\" privateAttrs\" :[]}}]" >>
125
145
}, Options , []).
126
146
147
+ check_secure_default_httpc_events_endpoint_federal (_ ) ->
148
+ Options = [{ssl , ldclient_config :tls_basic_options ()}],
149
+ {ok , _ } = httpc :request (post , {" https://events.launchdarkly.us/bulk" , [
150
+ {" Authorization" , os :getenv (" LD_FED_SDK_KEY" )},
151
+ {" X-LaunchDarkly-Event-Schema" , ldclient_config :get_event_schema ()},
152
+ {" User-Agent" , ldclient_config :get_user_agent ()}],
153
+ " application/json" ,
154
+ <<" [{\" endDate\" :1634839284004,\" features\" :{\" test-boolean-flag\" :{\" counters\" :[{\" count\" :1,\" unknown\" :false,\" value\" :true,\" variation\" :0,\" version\" :1}],\" default\" :\" default-value\" }},\" kind\" :\" summary\" ,\" startDate\" :1634839284004},{\" creationDate\" :1634839284004,\" kind\" :\" index\" ,\" user\" :{\" firstName\" :\" Tester\" ,\" key\" :\" 12345-track\" ,\" lastName\" :\" Testerson\" ,\" privateAttrs\" :[]}}]" >>
155
+ }, Options , []).
156
+
127
157
check_secure_default_httpc_valid (_ ) ->
128
158
Options = [{ssl , ldclient_config :tls_basic_options ()}],
129
159
{ok , _ } = httpc :request (get , {" https://tls-v1-2.badssl.com:1012/" , []}, Options , []),
@@ -175,4 +205,4 @@ check_secure_default_shotgun_invalid(_) ->
175
205
tls_options => ldclient_config :tls_basic_options (),
176
206
connect_timeout => undefined ,
177
207
custom_headers => undefined
178
- }).
208
+ }, " LD_SDK_KEY " ).
0 commit comments