fix(integrations): Ensure httpclient integration works with Request#7786
Merged
fix(integrations): Ensure httpclient integration works with Request#7786
Conversation
We cannot clone a request if it has a body which was read (which seems to happen somewhere). So instead we just re-use the same request if possible, instead of creating a new one.
lforst
reviewed
Apr 7, 2023
| "build:dev": "yarn build", | ||
| "build:watch": "run-p build:transpile:watch build:types:watch", | ||
| "build:dev:watch": "run-p build:watch", | ||
| "build:transpile:watch": "yarn build:rollup --watch", |
Member
Author
There was a problem hiding this comment.
just noticed this while working here that this is actually referencing wrong commands, so fixed them while at it! same for integration-shims, copy paste error 😅
lforst
approved these changes
Apr 7, 2023
Contributor
size-limit report 📦
|
AbhiPrasad
approved these changes
Apr 7, 2023
Member
Author
|
OK, turns out we can't do (all of) this - we actually use the passed in request and add headers to it in browser tracing, so we cannot swap this with a clone. So I'll only do the change for the httpclient integration, which should be fine too. |
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.
We cannot clone a request if it has a body which was read (which seems to happen somewhere). So instead we just re-use the same request if possible, instead of creating a new one.
This fixes this in two places:
argsin the first place.httpclientintegration, and avoid creating unnecessary copies of the Request where we don't need it.I added some tests for different scenarios covering this.
Fixes #7785