Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Minimal v2 protocol fixes #387

Merged
merged 1 commit into from Mar 18, 2016

Conversation

Projects
None yet
3 participants
Member

johnataylor commented Mar 17, 2016

@yishaigalatzer
This pull request represents the minimal working changes for Klondike.

  1. we send Accept headers correctly and 2) for search we send short name for target framework

@csharpfritz
We are also expecting users to have to use Klondike with host/api/odata and not host/api because for 3.4 because we are not fixing the fact that we don't correctly processes odata base address. If the initial request is redirected our client won't work because the base address specified in the root OData ServiceDocument will not be picked up.

@emgarten emgarten commented on an outdated diff Mar 17, 2016

....Core/NuGet.Protocol.Core.v3/HttpSource/HttpSource.cs
@@ -171,6 +172,19 @@ public HttpSource(PackageSource source, Func<Task<HttpHandlerResource>> messageH
}
}
+ public Task<HttpResponseMessage> GetAsync(Uri uri, MediaTypeWithQualityHeaderValue[] accept, ILogger log, CancellationToken token)
+ {
+ var request = new HttpRequestMessage(HttpMethod.Get, uri);
+ foreach (var a in accept)
+ {
+ request.Headers.Accept.Add(a);
+ }
+
+ Func<HttpRequestMessage> requestFactory = () => request;
@emgarten

emgarten Mar 17, 2016

Contributor

This should create a completely new request, see: #378

@emgarten emgarten commented on the diff Mar 17, 2016

...RemoteRepositories/RemoteV2FindPackageByIdResource.cs
@@ -126,6 +127,7 @@ private Task<IEnumerable<PackageInfo>> EnsurePackagesAsync(string id, Cancellati
// So we decide to leave current logic and observe.
using (var data = await _httpSource.GetAsync(
uri,
+ new[] { new MediaTypeWithQualityHeaderValue("application/atom+xml"), new MediaTypeWithQualityHeaderValue("application/xml") },
@emgarten

emgarten Mar 17, 2016

Contributor

nit: this looks like it should be a shared static so since it doesn't change but it used all over and recreated many times

Contributor

emgarten commented Mar 17, 2016

🚀

@johnataylor johnataylor merged commit 7f8b4c1 into dev Mar 18, 2016

@alpaix alpaix deleted the minimal-v2-protocol-fixes branch Jul 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment