Based on the v1.1.0 code, it looks like Rest.Request is making a network call to api.nuget.org prior to every call to the SMSGlobal REST service. I believe this is unnecessary and wasteful.
The purpose seems to be obtaining the latest version of the package to put in the User-Agent header. It seems to me like it would be more valuable to include the currently running package version.
Suggestions to fix:
- If possible, eliminate the call to
api.nuget.org, and use the current assembly's version. (For example, using typeof(Client).Assembly.GetName().Version.)
- If the Nuget call is necessary for some reason, call it once and cache the result in a singleton, or similar.
- If the Nuget call is necessary as part of every call, as it's coded now, add comments to explain why.
Also please note that the HttpClient instantiated on line 375 (as of tag 1.1.0) is not properly disposed.
Based on the v1.1.0 code, it looks like
Rest.Requestis making a network call toapi.nuget.orgprior to every call to the SMSGlobal REST service. I believe this is unnecessary and wasteful.The purpose seems to be obtaining the latest version of the package to put in the
User-Agentheader. It seems to me like it would be more valuable to include the currently running package version.Suggestions to fix:
api.nuget.org, and use the current assembly's version. (For example, usingtypeof(Client).Assembly.GetName().Version.)Also please note that the
HttpClientinstantiated on line 375 (as of tag 1.1.0) is not properly disposed.