コード例 #1
0
 internal static ODataMessageWrapper Create(Stream stream, HttpContentHeaders headers, IDictionary <string, string> contentIdMapping)
 {
     return(new ODataMessageWrapper(
                stream,
                headers.ToDictionary(kvp => kvp.Key, kvp => String.Join(";", kvp.Value)),
                contentIdMapping));
 }
        // Combine response- and responsecontent header to one dictionary
        private static Dictionary <string, string> GetResponseHeaderDictionary(HttpResponseHeaders responseMessageHeaders, HttpContentHeaders contentHeaders)
        {
            var responseHeaders = responseMessageHeaders.ToDictionary(h => h.Key, h => string.Join(";", h.Value));
            var allHeaders      = contentHeaders.ToDictionary(h => h.Key, h => string.Join(";", h.Value));

            responseHeaders.ToList().ForEach(x => allHeaders[x.Key] = x.Value);
            return(allHeaders);
        }
コード例 #3
0
        private ResponseMessageCacheEntry(string etag, DateTimeOffset?lastModified, HttpStatusCode statusCode, HttpResponseHeaders responseHeaders, HttpContentHeaders contentHeaders, byte[] contentBytes)
        {
            if (responseHeaders == null)
            {
                throw new ArgumentNullException(nameof(responseHeaders));
            }
            if (etag == null && !lastModified.HasValue)
            {
                throw new InvalidOperationException("Must have at least one of an ETag or LastModified value");
            }

            ETag           = etag;
            LastModified   = lastModified;
            StatusCode     = statusCode;
            Headers        = responseHeaders.ToDictionary(kv => kv.Key, kv => AsReadOnlyCollection(kv.Value));
            ContentHeaders = contentHeaders.ToDictionary(kv => kv.Key, kv => AsReadOnlyCollection(kv.Value));
            ContentBytes   = contentBytes;
        }