Skip to content
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

feat(ext/fetch): allow Deno.HttpClient to be declared with using #21453

Merged
merged 3 commits into from
Dec 6, 2023

Conversation

magurotuna
Copy link
Member

This commit adds a method of Symbol.dispose to the object returned from Deno.createHttpClient, so we can make use of explicit resource management by declaring it with using.

Comment on lines 42 to 44
[SymbolDispose]() {
this.close();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be tryClose so it doesn't throw if someone explicitly calls close beforehand?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should! I fixed that and added a test case in 77e0ef2

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@magurotuna magurotuna merged commit dadd8b3 into denoland:main Dec 6, 2023
14 checks passed
@magurotuna magurotuna deleted the http-client-dispose branch December 6, 2023 07:53
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.

None yet

2 participants