fix(redis): Remove empty object body from GET requests to Redis API - #3251
Merged
Conversation
Contributor
|
Tested all |
troycoll
approved these changes
Mar 11, 2025
mars
approved these changes
Mar 11, 2025
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.
Description
There's a bug in the
requestfunction from the shared Redis API lib file used for most ofredis:...commands, where the default value for the request body is an empty object ({}). That makes allGETrequests using that function to send that empty body when, according to standards,GETrequests shouldn't send a body.Here we change the default to a
nullvalue, so no body gets sent withGETrequests and add an empty object body to all non-GET requests that would've inherited the previous default to avoid behavior changes.Testing
Checkout this branch, ensure you're running Node 20.x and run
yarn && yarn build. For the tests you will need access to a test app with a Redis database installed. If you don't have one at hand let me know and I can add you to one of my test apps.There will be no behavior change on execution of the commands, only the headers sent with the request will change.
You should see on the Redis API request debug output (
GET https://api.heroku.com/redis/v0/databases/...) that the following headers are set:You should see on the Redis API request debug output (
GET https://api.heroku.com/redis/v0/databases/...) that nocontent-typeandcontent-lengthheaders are included and the accept header is now:GETrequests likeredis:waitandredis:credentials. The same behavior should be observed.SOC2 Compliance
GUS Work Item: W-18015751