File tree Expand file tree Collapse file tree 3 files changed +20
-16
lines changed Expand file tree Collapse file tree 3 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ class Flagsmith constructor(
116116                    result(it.map { response ->  response.flags })
117117                }).also  { lastUsedIdentity =  identity }
118118            } else  {
119-                 retrofit.getIdentityFlagsAndTraits(identity, transient).enqueueWithResult { res -> 
119+                 retrofit.getIdentityFlagsAndTraits(identity, if  ( transient)  true   else   null ).enqueueWithResult { res -> 
120120                    flagUpdateFlow.tryEmit(res.getOrNull()?.flags ? :  emptyList())
121121                    result(res.map { it.flags })
122122                }
Original file line number Diff line number Diff line change @@ -240,4 +240,23 @@ class FeatureFlagTests {
240240            assertTrue(result.isSuccess)
241241        }
242242    }
243+ 
244+     @Test
245+     fun  testGetFeatureFlagsWithNullTraitsHasNoTransientParam () {
246+         mockServer.mockResponseFor(MockEndpoint .GET_IDENTITIES )
247+ 
248+         runBlocking {
249+             flagsmith.getFeatureFlagsSync(" "  , null , false )
250+             val  requests =  mockServer.retrieveRecordedRequests(
251+                 request()
252+                     .withPath(" /identities/"  )
253+                     .withMethod(" GET"  )
254+             )
255+             assertEquals(1 , requests.size)
256+             val  request =  requests[0 ]
257+             val  transientParam =  request.queryStringParameterList.find { it.name.toString() ==  " transient"   }
258+             assertNull(" transient parameter should not be present"  , transientParam)
259+         }
260+     }
261+ 
243262}
Original file line number Diff line number Diff line change @@ -58,21 +58,6 @@ class IdentityTests {
5858        }
5959    }
6060
61-     @Test(expected =  AssertionError ::class )
62-     fun  testGetIdentityWithExpectedParameterMissing () {
63-         mockServer.mockResponseFor(MockEndpoint .GET_IDENTITIES )
64-         runBlocking {
65-             flagsmith.getIdentitySync(" person"  )
66- 
67-             mockServer.verify(
68-                 request()
69-                     .withPath(" /identities/"  )
70-                     .withMethod(" GET"  )
71-                     .withQueryStringParameter(" transient"  )
72-             )
73-         }
74-     }
75- 
7661    @Test
7762    fun  testGetIdentityWithoutTransientParameter () {
7863        mockServer.mockResponseFor(MockEndpoint .GET_IDENTITIES )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments