Repository navigation
Add go to definition for packages - #27
Conversation
|
@mlorbetske, |
55163a7 to
f74c2ca
Compare
|
Nice! 👍 |
|
|
||
| private static bool PackageExistsOnNuGet(string packageName, string version, out string url) | ||
| { | ||
| string packageAndVersionUrl = $"https://www.nuget.org/packages/{packageName}/{version}/"; |
There was a problem hiding this comment.
It would be nice if the logic of finding the Nuget package would reside inside the .Nuget project.
On a side note, the Definition class is intended to be an abstraction level for the set of matches. However, the implementation currently is very limited (we would need to implement what we were calling Resolvers; that would allow us to write this code in a more generic way).
For now, I think that is fine.
| } | ||
| else | ||
| { | ||
| response = client.GetAsync(packageAndVersionUrl).Result; |
There was a problem hiding this comment.
Why are you fetching the same URL again? Isn't this supposed to be packageUrl?
| { | ||
| HttpResponseMessage response = client.GetAsync(packageAndVersionUrl).Result; | ||
|
|
||
| if (response.StatusCode == System.Net.HttpStatusCode.OK) |
There was a problem hiding this comment.
Because of a NuGet gallery bug (NuGet/NuGetGallery#4624), this will always be true, as long as the package ID is correct.
| { | ||
| using (HttpClient client = new HttpClient()) | ||
| { | ||
| HttpResponseMessage response = client.GetAsync(packageAndVersionUrl).Result; |
There was a problem hiding this comment.
Wouldn't it be better to issue a HEAD request here? You're not interested in the body after all...
Fixes #26