-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compression #17
Compression #17
Conversation
Thanks. That is great! However it seems that your change only compresses the response, which doesn't have benefit for pdf/excel reports. Didn't you want to rather compress the request body? public async Task<Report> RenderAsync(object request, CancellationToken ct = default(CancellationToken))
{
var client = CreateClient();
byte[] jsonBytes = Encoding.UTF8.GetBytes(ValidateAndSerializeRequest(request));
var ms = new MemoryStream();
using (var gzip = new GZipStream(ms, CompressionMode.Compress, true))
{
gzip.Write(jsonBytes, 0, jsonBytes.Length);
}
ms.Position = 0;
var content = new StreamContent(ms);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
content.Headers.ContentEncoding.Add("gzip");
var response =
await
client.PostAsync("api/report", content, ct).ConfigureAwait(false);
if (response.StatusCode != HttpStatusCode.OK)
throw JsReportException.Create("Unable to render template. ", response);
response.EnsureSuccessStatusCode();
return await ReportFromResponse(response).ConfigureAwait(false);
} |
Ah yes, I was mistaken. I'll update and test it accordingly. |
Looks great and works for me. I'm going to merge it in, if it is complete from you. |
Thanks :) |
Great job, thank you. |
Any idea when the NuGet-package will be updated? |
Adds gzip-compression to the .NET-client library
Related to issue: #16