public void AddResponseHeader_ContentDisposition_AddsExpectedHeader() { HttpResponseMessage response = new HttpResponseMessage() { Content = new StringContent("Test") }; var cd = "attachment; filename=\"test.txt\""; var header = new KeyValuePair <string, object>("content-disposition", cd); HttpBinding.AddResponseHeader(response, header); Assert.Equal(cd, response.Content.Headers.ContentDisposition.ToString()); }
public void AddResponseHeader_ContentMD5_AddsExpectedHeader() { HttpResponseMessage response = new HttpResponseMessage() { Content = new StringContent("Test") }; byte[] bytes = Encoding.UTF8.GetBytes("This is a test"); var header = new KeyValuePair <string, object>("content-md5", bytes); HttpBinding.AddResponseHeader(response, header); Assert.Equal(bytes, response.Content.Headers.ContentMD5); response = new HttpResponseMessage() { Content = new StringContent("Test") }; string base64 = Convert.ToBase64String(bytes); header = new KeyValuePair <string, object>("content-md5", base64); HttpBinding.AddResponseHeader(response, header); Assert.Equal(base64, Convert.ToBase64String(response.Content.Headers.ContentMD5)); }