/// <summary>Initializes a new instance of the NServiceKit.Common.Web.CompressedResult class.</summary> /// /// <exception cref="ArgumentException">Thrown when one or more arguments have unsupported or illegal values.</exception> /// /// <param name="contents"> The contents.</param> /// <param name="compressionType">Type of the compression.</param> /// <param name="contentMimeType">Type of the content mime.</param> public CompressedResult(byte[] contents, string compressionType, string contentMimeType) { if (!CompressionTypes.IsValid(compressionType)) { throw new ArgumentException("Must be either 'deflate' or 'gzip'", compressionType); } this.StatusCode = HttpStatusCode.OK; this.ContentType = contentMimeType; this.Contents = contents; this.Headers = new Dictionary <string, string> { { HttpHeaders.ContentEncoding, compressionType }, }; }