public void JsonBatchBinaryContentTypeTest() { ODataJsonBatchPayloadTestCase testCase = new ODataJsonBatchPayloadTestCase { Description = "Batch request of binary body and headers in different order, or content-type header is an empty string.", RequestPayload = @" { ""requests"": [ { ""body"": ""__ENCODED_BINARY_CONTENT__"", ""headers"": { ""Content-Type"": ""my-binary/*"", ""OData-Version"": ""4.0"" }, ""method"": ""POST"", ""url"": ""http://odata.org/test/Users HTTP/1.1"", ""id"": ""r1"" }, { ""id"": ""r2"", ""headers"": { ""Content-Type"": ""my-other-binary/*"" }, ""method"": ""POST"", ""url"": ""http://odata.org/test/Users HTTP/1.1"", ""body"": ""__ENCODED_BINARY_CONTENT__"" }, { ""id"": ""r3"", ""headers"": { ""Content-Type"": """" }, ""method"": ""POST"", ""url"": ""http://odata.org/test/Users HTTP/1.1"", ""body"": ""__ENCODED_BINARY_CONTENT__"" } ] }", RequestMessageDependsOnIdVerifier = null, ContentTypeVerifier = (message, offset) => VerifyOperationRequestMessage( message, offset, new string[] { "r1", "r2", "r3" }, new int[] { 2, 1, 1 }) }; testCase.PopulateEncodedContent("__ENCODED_BINARY_CONTENT__", JsonLightUtils.GetBase64UrlEncodedString(this.binarySampleBytes)); ServiceProcessBatchRequest(testCase, ODataVersion.V4); }
public void JsonBatchTextualContentTypeTest() { ODataJsonBatchPayloadTestCase testCase = new ODataJsonBatchPayloadTestCase { Description = "Batch request of Textual body and headers in different order.", RequestPayload = @" { ""requests"": [ { ""body"": ""__ENCODED_TEXTUAL_CONTENT__"", ""method"": ""POST"", ""url"": ""http://odata.org/test/Users HTTP/1.1"", ""headers"": { ""Content-Type"": ""text/plain"", ""OData-Version"": ""4.0"" }, ""id"": ""r1"" }, { ""id"": ""r2"", ""method"": ""POST"", ""url"": ""http://odata.org/test/Users HTTP/1.1"", ""headers"": { ""Content-Type"": ""text/*; odata.metadata=minimal"" }, ""body"": ""__ENCODED_TEXTUAL_CONTENT__"" } ] }", RequestMessageDependsOnIdVerifier = null, ContentTypeVerifier = (message, offset) => VerifyOperationRequestMessage(message, offset, new string[] { "r1", "r2" }, new int[] { 2, 1 }) }; testCase.PopulateEncodedContent("__ENCODED_TEXTUAL_CONTENT__", JsonLightUtils.GetJsonEncodedString(textualSampleString)); ServiceProcessBatchRequest(testCase, ODataVersion.V4); }