File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
providers/openfeature-provider-flagd
src/openfeature/contrib/provider/flagd/resolvers/process/connector Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -216,14 +216,14 @@ def _create_request_args(self) -> dict:
216216
217217 def _create_metadata (self ) -> typing .Optional [typing .List [typing .Tuple [str , str ]]]:
218218 """Create gRPC metadata headers for the request.
219-
219+
220220 Returns gRPC metadata as a list of tuples containing header key-value pairs.
221221 The selector is passed via the 'flagd-selector' header per flagd v0.11.0+ specification,
222222 while also being included in the request body for backward compatibility with older flagd versions.
223223 """
224224 if self .selector is None :
225225 return None
226-
226+
227227 return [("flagd-selector" , self .selector )]
228228
229229 def _fetch_metadata (self ) -> typing .Optional [sync_pb2 .GetMetadataResponse ]:
@@ -247,12 +247,12 @@ def listen(self) -> None: # noqa: C901
247247 call_args : GrpcMultiCallableArgs = {"wait_for_ready" : True }
248248 if self .streamline_deadline_seconds > 0 :
249249 call_args ["timeout" ] = self .streamline_deadline_seconds
250-
250+
251251 # Add selector via gRPC metadata header (flagd v0.11.0+ preferred approach)
252252 metadata = self ._create_metadata ()
253253 if metadata is not None :
254254 call_args ["metadata" ] = metadata
255-
255+
256256 request_args = self ._create_request_args ()
257257
258258 while self .active :
Original file line number Diff line number Diff line change @@ -148,16 +148,16 @@ def test_selector_passed_via_both_metadata_and_body(self):
148148
149149 # Verify SyncFlags was called
150150 self .mock_stub .SyncFlags .assert_called_once ()
151-
151+
152152 # Get the call arguments
153153 call_args = self .mock_stub .SyncFlags .call_args
154-
154+
155155 # Verify the request contains selector in body (backward compatibility)
156156 request = call_args .args [0 ] # First positional argument is the request
157- self .assertEqual (request .selector , ' test-selector' )
158-
157+ self .assertEqual (request .selector , " test-selector" )
158+
159159 # Verify metadata also contains flagd-selector header (new approach)
160160 kwargs = call_args .kwargs
161- self .assertIn (' metadata' , kwargs )
162- metadata = kwargs [' metadata' ]
163- self .assertEqual (metadata , [(' flagd-selector' , ' test-selector' )])
161+ self .assertIn (" metadata" , kwargs )
162+ metadata = kwargs [" metadata" ]
163+ self .assertEqual (metadata , [(" flagd-selector" , " test-selector" )])
You can’t perform that action at this time.
0 commit comments