public void CanHandleGzipEncoding() { using (var server = LocalWebServer.ListenInBackground(new XUnitMockLogger(_logger))) { var buffer = Encoding.UTF8.GetBytes(TestResource.SerializedDefault1); var ms = new MemoryStream(); using (var zip = new GZipStream(ms, CompressionMode.Compress, true)) { zip.Write(buffer, 0, buffer.Length); } ms.Position = 0; var content = new StreamContent(ms); content.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/json") { CharSet = "utf-8" }; content.Headers.ContentEncoding.Add("gzip"); server.WithNextResponse(new MockHttpResponseMessage(HttpStatusCode.OK).WithHttpContent(content).WithHeader("Vary", "Accept-Encoding")); var result = new HalBuilderFactory().Create() .WithLink(server.ListeningUri).ResultAsync <TestResource>(); result.ShouldNotBeNull(); } }
public void CanUseInterface() { var builder = new HalBuilderFactory().Create(); }