compress only if content exists
This commit is contained in:
@@ -48,5 +48,5 @@ gulp.task('pack', ['build'], ()=>{
|
||||
|
||||
gulp.task('publish', ['pack'], ()=>{
|
||||
return gulp.src('./nupkgs/*.nupkg')
|
||||
.pipe(nuget.push({ nuget: "nuget.exe", source: 'https://www.nuget.org/api/v2/package', apiKey: '9d1cc8fb-2c00-47cc-93ff-153a8871052d'}));
|
||||
.pipe(nuget.push({ nuget: "nuget.exe", source: 'https://www.nuget.org/api/v2/package', apiKey: process.env.nugetApiKey}));
|
||||
});
|
||||
@@ -24,6 +24,10 @@ namespace CompressR.WebApi
|
||||
|
||||
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
|
||||
{
|
||||
if(actionExecutedContext.Response.Content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var acceptedEncoding = actionExecutedContext
|
||||
.Response
|
||||
.RequestMessage
|
||||
@@ -45,12 +49,15 @@ namespace CompressR.WebApi
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
actionExecutedContext.Response.Content = new CompressedContent(actionExecutedContext.Response.Content, acceptedEncoding);
|
||||
}
|
||||
|
||||
public override async Task OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)
|
||||
{
|
||||
if(actionExecutedContext.Response.Content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var acceptedEncoding = actionExecutedContext
|
||||
.Response
|
||||
.RequestMessage
|
||||
|
||||
@@ -23,6 +23,10 @@ namespace CompressR.WebApi
|
||||
|
||||
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
|
||||
{
|
||||
if(actionExecutedContext.Response.Content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var acceptedEncoding = actionExecutedContext
|
||||
.Response
|
||||
.RequestMessage
|
||||
@@ -40,6 +44,10 @@ namespace CompressR.WebApi
|
||||
|
||||
public override async Task OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)
|
||||
{
|
||||
if(actionExecutedContext.Response.Content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var acceptedEncoding = actionExecutedContext
|
||||
.Response
|
||||
.RequestMessage
|
||||
|
||||
@@ -22,6 +22,10 @@ namespace CompressR.WebApi
|
||||
|
||||
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
|
||||
{
|
||||
if(actionExecutedContext.Response.Content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var acceptedEncoding = actionExecutedContext
|
||||
.Response
|
||||
.RequestMessage
|
||||
@@ -39,6 +43,10 @@ namespace CompressR.WebApi
|
||||
|
||||
public override async Task OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)
|
||||
{
|
||||
if(actionExecutedContext.Response.Content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var acceptedEncoding = actionExecutedContext
|
||||
.Response
|
||||
.RequestMessage
|
||||
|
||||
Reference in New Issue
Block a user