fix: preserve app attributes when generating a new key#718
Open
saiflayouni wants to merge 2 commits into
Open
Conversation
The Apigee POST /developers/{dev}/apps/{name} endpoint generates a new
key but also updates the app, clearing any field absent from the request
body. GenerateKey did not include existing attributes in its payload, so
all app attributes were wiped on every genkey call.
Fix by fetching the current app before the POST and re-including its
attributes in the payload.
Fixes apigee#651
…est arg count Replace unsafe string-concatenation for attribute JSON with json.Marshal, which correctly handles any special characters in attribute names/values. Also fix pre-existing test breakage in keys_test.go where ManageKey was called with 4 arguments instead of the required 5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
GenerateKeywas POSTing to/developers/{dev}/apps/{name}without including the app's existing attributes in the payloadFixes #651
Test plan
TestGenerateKeyininternal/client/apps/apps_test.goto assert that app attributes are present in the response after key generationgo test -v -run TestGenerateKey ./...