Exemple #1
0
 /// <summary>
 /// Applies headers in the dictionary to a response message.
 /// </summary>
 /// <param name="headers">The dictionary with the headers to apply.</param>
 /// <param name="responseMessage">The request message to apply the headers to.</param>
 private static void ApplyHeadersToResponse(HeaderCollection headers, IODataResponseMessage responseMessage)
 {
     // NetCF bug with how the enumerators for dictionaries work.
     foreach (KeyValuePair <string, string> header in headers.AsEnumerable().ToList())
     {
         responseMessage.SetHeader(header.Key, header.Value);
     }
 }
Exemple #2
0
        /// <summary>
        /// Applies headers in the dictionary to a request message.
        /// </summary>
        /// <param name="headers">The dictionary with the headers to apply.</param>
        /// <param name="requestMessage">The request message to apply the headers to.</param>
        /// <param name="ignoreAcceptHeader">If set to true the Accept header will be ignored.</param>
        internal static void ApplyHeadersToRequest(HeaderCollection headers, IODataRequestMessage requestMessage, bool ignoreAcceptHeader)
        {
            // NetCF bug with how the enumerators for dictionaries work.
            foreach (KeyValuePair <string, string> header in headers.AsEnumerable().ToList())
            {
                if (string.Equals(header.Key, XmlConstants.HttpRequestAccept, StringComparison.Ordinal) && ignoreAcceptHeader)
                {
                    continue;
                }

                requestMessage.SetHeader(header.Key, header.Value);
            }
        }