Skip to content

Identities are not correctly URL encoded #124

@mjwills-k

Description

@mjwills-k

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

url += $"?identifier={identity}{(transient ? $"&transient={transient}" : "")}";
needs fixing, but not
jsonBody = JsonConvert.SerializeObject(new { identifier = identity, traits, transient });
.

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);
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions