Don't delete object key when it equals the rename.to in a rename with regex#1763
Don't delete object key when it equals the rename.to in a rename with regex#1763paixaop wants to merge 3 commits intohapijs:masterfrom paixaop:master
Conversation
…ausing the original key to be deleted if rename.options.alias was false
|
Test |
|
It was not clear to me that you were fixing the issue with deleted keys, and also implementing a new feature. Neither the PR discussion nor the git commits mention the new Please separate the two into different branches and different PRs so they can be reviewed separately. I would also suggest opening up a issue on |
|
While I understand what you're trying to do, nodejs already lowercases the headers so I don't really see the point. As Wes already told, you didn't open an issue 1st, so maybe I'm lacking the context usually asked in issues. |
|
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Calling rename with a regex where the key matches the
rename.tocauses the key to get deleted from the object.Example: I use the folllowing schema to validate an AWS x-api-key header:
Using rename to force a value such as 'X-ApI-KeY' to be all lower case, and therefore normalizing it to 'x-api-key'.
The bug is when the header is already all lower case 'x-api-key', the
rename.fromis the same asrename.toso it gets deleted ifoption.alias = false, leaving the object with nox-api-keyat all.So this: