Skip to content

chore(protocol-http): guidance for HttpRequest cloning #1333

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

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Jul 10, 2024

This moves HttpRequest#clone() (instance method) to HttpRequest.clone(IHttpRequest) (static method) and deprecates the original instance method.

HttpRequest#clone() cannot safely be called, because the type-guard HttpRequest.isInstance(unknown) is not correctly implemented, but cannot safely be changed since it is widely used as-is.

Context:

HttpRequest.isInstance(unknown) -> boolean is HttpRequest is actually
HttpRequest.isInstance(unknown) -> boolean is IHttpRequest.

It returns true when the input satisfies the data/structural interface, but the structural interface does not necessarily include the .clone() method.

@kuhe kuhe requested review from a team as code owners July 10, 2024 18:56
@kuhe kuhe requested a review from kstich July 10, 2024 18:56
@kuhe
Copy link
Contributor Author

kuhe commented Jul 10, 2024

In a later major version of @smithy/protocol-http, the HttpRequest.isInstance(unknown) function can be made less misleading with a non-backwards-compatible change.

@kuhe kuhe merged commit 796567d into smithy-lang:main Jul 12, 2024
10 checks passed
@kuhe kuhe deleted the httpRequest branch July 12, 2024 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants