D
Deno

help

Proper usage of `Deno.HttpClient`

Wwulfey8/1/2023
Hi! I'm creating an application which allows the internal use of HTTP proxies for certain tasks. In that case, fetch() requests are given an instance of Deno.HttpClient per proxy, but for multiple fetch() calls, if they're supposed to use the same proxy, the same HttpClient instance is used. This is something I am curious about, should I create a new HttpClient for every executed fetch(), or is it fine to reuse the same HttpClients for multiple requests? It's a decision that randomly came to mind, but depending on what is truly better, the background functionality should be based around the proper decision.

Looking for more? Join the community!