Flagsmith / flagsmith-dotnet-client

.NET Standard Client for Flagsmith. Ship features with confidence using feature flags and remote config. Host yourself or use our hosted version at https://www.flagsmith.com/
https://www.flagsmith.com/
BSD 3-Clause "New" or "Revised" License
19 stars 15 forks source link

Identities are not correctly URL encoded #124

Open mjwills-k opened 2 weeks ago

mjwills-k commented 2 weeks ago

The below code generates an identity of ZZGGHH_abc rather than the expected ZZGGHH_abc&h=g. I suspect some of your code is not correctly url encoding inputs.

Note that the code does work if you pass in traits. So I suspect https://github.com/Flagsmith/flagsmith-dotnet-client/blob/4a83292a4b7b2752b5ca4fd38873e9d4b1adeab4/Flagsmith.FlagsmithClient/FlagsmithClient.cs#L366 needs fixing, but not https://github.com/Flagsmith/flagsmith-dotnet-client/blob/4a83292a4b7b2752b5ca4fd38873e9d4b1adeab4/Flagsmith.FlagsmithClient/FlagsmithClient.cs#L361 .

using Flagsmith;

namespace TestsForFlagSmith
{
    public class IssueForFlagSmith : TestsCommon
    {
        protected static readonly Lazy<FlagsmithClient> _flagsmithClient = new Lazy<FlagsmithClient>(() => new FlagsmithClient("keyhere"));

        [Test]
        public async Task CorrectIdentityIsGenerated()
        {
            var identity = "ZZGGHH_abc&h=g";

            var flags = await _flagsmithClient.Value.GetIdentityFlags(identity);
        }
    }
}
matthewelwell commented 2 weeks ago

Thanks for raising this @mjwills-k - we'd gratefully receive a PR to fix this.