CompressResponseAttribute does not apply HttpResult.ContentType to response

I’m returning a HttpResult with ContentType set to “image/png” from a service decorated with the [CompressResponse] attribute.

Further down the pipeline (at CompressResponseAttribute.cs:72) res.ResponseContentType is used instead of the content type I set on my HttpResult.

I can circumvent this by setting the ResponseContentType but I’d expect the ContentType from HttpResult to be used here.

Thanks,
Robert van Drunen

In the same context:

When I throw an HttpError it ends up as an ErrorResponse in CompressResponseAttribute.Execute.

The status code from the HttpError is not set on the response.

Throwing Exceptions in [CompressResponse] should already be resolved with the pre-release packages on MyGet whilst the Content Type issue should be resolved in this commit.

This change is available from v4.5.9 that’s now available on MyGet.

1 Like