tnc1997 / azure-app-configuration-emulator

Please note that Emulator for Azure App Configuration is unofficial and not endorsed by Microsoft.
MIT License
3 stars 3 forks source link

Keys with slashes (inc. feature flags) return 404 #39

Closed paulirwin closed 8 months ago

paulirwin commented 8 months ago

Describe the bug Attempted to recreate some HTTP calls that work with the real Azure App Config API, like PUT'ing a feature flag, and it fails with a 404 if the key in the URL contains a slash. Feature flags have a key prefix of .appconfig.featureflag/ so the URL is like /kv/.appconfig.featureflag/MyFlagName

Note that the solution is not to URL encode the slash, as that does not match the behavior of Azure App Config.

Current behavior Steps to reproduce the behavior:

  1. Use Postman to PUT /kv/.appconfig.featureflag/MyFlagName with a valid feature flag body (see below)
  2. 404 is returned instead of expected 200 OK

Example feature flag body:

{
    "key": ".appconfig.featureflag/MyFlagName",
    "label": null,
    "content_type": "application/vnd.microsoft.appconfig.ff+json;charset=utf-8",
    "value": "{\"id\":\"MyFlagName\",\"description\":\"\",\"enabled\":true,\"conditions\":{\"client_filters\":[{\"name\":\"Microsoft.Targeting\",\"parameters\":{\"Audience\":{\"Users\":[],\"Groups\":[],\"DefaultRolloutPercentage\":0}}}]}}",
    "tags": {}
}

Expected behavior 200 OK result

Screenshots N/A

Additional context I will attempt to fix this problem and submit a PR.