/// <summary>
        /// Reads the headers of a batch part or an operation.
        /// </summary>
        /// <returns>A dictionary of header names to header values; never null.</returns>
        internal ODataBatchOperationHeaders ReadHeaders()
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(this.batchEncoding != null, "Batch encoding should have been established on first call to SkipToBoundary.");

            ODataBatchOperationHeaders headers = new ODataBatchOperationHeaders();

            // Read all the headers
            string headerLine = this.ReadLine();

            while (headerLine != null && headerLine.Length > 0)
            {
                string headerName, headerValue;
                ValidateHeaderLine(headerLine, out headerName, out headerValue);

                if (headers.ContainsKeyOrdinal(headerName))
                {
                    throw new ODataException(Strings.ODataBatchReaderStream_DuplicateHeaderFound(headerName));
                }

                headers.Add(headerName, headerValue);
                headerLine = this.ReadLine();
            }

            return(headers);
        }
예제 #2
0
        internal ODataBatchOperationHeaders ReadHeaders()
        {
            ODataBatchOperationHeaders headers = new ODataBatchOperationHeaders();

            for (string str = this.ReadLine(); (str != null) && (str.Length > 0); str = this.ReadLine())
            {
                string str2;
                string str3;
                ValidateHeaderLine(str, out str2, out str3);
                if (headers.ContainsKeyOrdinal(str2))
                {
                    throw new ODataException(Strings.ODataBatchReaderStream_DuplicateHeaderFound(str2));
                }
                headers.Add(str2, str3);
            }
            return(headers);
        }