fix(redis): Remove empty object body from GET requests to Redis API #3251
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
request
function 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 allGET
requests using that function to send that empty body when, according to standards,GET
requests shouldn't send a body.Here we change the default to a
null
value, so no body gets sent withGET
requests 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-type
andcontent-length
headers are included and the accept header is now:GET
requests likeredis:wait
andredis:credentials
. The same behavior should be observed.SOC2 Compliance
GUS Work Item: W-18015751