Remove Content-Length header from nock responses#3839
Merged
Conversation
|
alecgard
approved these changes
May 6, 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
The update to nock v14 breaks a lot of tests.
Most (but not all) of the tests break because we specify an incorrect
Content-Lengthheader in the mock response.It seems like previously the incorrect header was just ignored or replaced and now it actually determines the length of the response. So the response gets cut off in the middle and can't be parsed as JSON.
Removing the
Content-Lengthheader from the mock response works fine and is a lot easier than figuring out the correct value for each of these.Changes
Remove
Content-Lengthheader from all nock responses.I did not try only removing the ones that cause failures. I just removed all of them.
Steps to Test
After applying this change on the nock update PR, the number of failing tests went from 114 to 3.
Quality Assurance
infra-k8sconfiguration file.adapter-secretsconfiguration file or update the soak testing blacklist.test-payload.jsonfile with relevant requests.feature/x,chore/x,release/x,hotfix/x,fix/x) or is created from Jira.