fix: allow empty appName as it may come in the url #3953
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
About the changes
Edit application under https://app.unleash-hosted.com/demo/applications/test-app is currently not working as the appName is expected to come in the request body, but it's actually part of the url. We have two options here:
In terms of REST API, we can assume that the appName will be present in the resource
/api/admin/metrics/applications
(an endpoint we don't have), but when we're updating an application we should refer to that application by its URL:/api/admin/metrics/applications/<appName>
and the presence of an appName in the body might indicate that we're trying to change the name of the application (something we currently not support)Based on the above, I believe going with the second option is best, as it adheres to REST principles and does not require a breaking change. Despite that, we only support updating applications as the creation is done from metrics ingestion
Fixes: #3580