-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(middleware-apply-body-checksum): fix request copying with clone #1324
Conversation
e225edb
to
b5e1202
Compare
...headers, | ||
"content-md5": options.base64Encoder(await digest), | ||
}, | ||
const cloned = request.clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a safe assumption.
HttpRequest.isInstance(request)
is incorrectly implemented. It only checks that a request is duck-like an HttpRequest interface. The clone
method only exists on the HttpRequest
class.
It wasn't a good idea naming interfaces and classes the same, even worse that they aren't identical types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: implement static HttpRequest.clone()
that accepts HttpRequest
interface. Deprecate instance method.
b5e1202
to
f5f42a4
Compare
This is no longer necessary due to #1345 |
re-opening because this PR is still good for code clarity |
Issue #, if available:
N/A
Description of changes:
Fixed a subtle bug when request copying, otherwise methods like
clone()
may not be copied over.If one or more of the packages in the
/packages
directory has been modified, be sureyarn changeset add
has been run and its output hasbeen committed and included in this pull request. See CONTRIBUTING.md.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.