LEFT | RIGHT |
1 /* | 1 /* |
2 Copyright 2011 Google Inc | 2 Copyright 2011 Google Inc |
3 | 3 |
4 Licensed under the Apache License, Version 2.0 (the "License"); | 4 Licensed under the Apache License, Version 2.0 (the "License"); |
5 you may not use this file except in compliance with the License. | 5 you may not use this file except in compliance with the License. |
6 You may obtain a copy of the License at | 6 You may obtain a copy of the License at |
7 | 7 |
8 http://www.apache.org/licenses/LICENSE-2.0 | 8 http://www.apache.org/licenses/LICENSE-2.0 |
9 | 9 |
10 Unless required by applicable law or agreed to in writing, software | 10 Unless required by applicable law or agreed to in writing, software |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 public string ResponseETag = "\"some-etag-here\""; | 197 public string ResponseETag = "\"some-etag-here\""; |
198 | 198 |
199 protected override async Task<HttpResponseMessage> SendAsyncCore(Htt
pRequestMessage request, | 199 protected override async Task<HttpResponseMessage> SendAsyncCore(Htt
pRequestMessage request, |
200 CancellationToken cancellationToken) | 200 CancellationToken cancellationToken) |
201 { | 201 { |
202 ThreadId = Thread.CurrentThread.ManagedThreadId; | 202 ThreadId = Thread.CurrentThread.ManagedThreadId; |
203 var mediaType = "application/json"; | 203 var mediaType = "application/json"; |
204 string strObject = null; | 204 string strObject = null; |
205 | 205 |
206 // If gzip enabled the request content is a gzip stream, otherwi
se it's a string content | 206 // If gzip enabled the request content is a gzip stream, otherwi
se it's a string content. |
207 if (GZipEnabled) | 207 if (GZipEnabled) |
208 { | 208 { |
209 Assert.That(request.Content, Is.AssignableFrom<StreamContent
>()); | 209 Assert.That(request.Content, Is.AssignableFrom<StreamContent
>()); |
210 var encoding = request.Content.Headers.ContentEncoding; | 210 var encoding = request.Content.Headers.ContentEncoding; |
211 Assert.That(encoding.Count == 1 && encoding.First().Equals("
gzip"), | 211 Assert.That(encoding.Count == 1 && encoding.First().Equals("
gzip"), |
212 "Content-Encoding should be 'gzip'"); | 212 "Content-Encoding should be 'gzip'"); |
213 var stream = await request.Content.ReadAsStreamAsync(); | 213 var stream = await request.Content.ReadAsStreamAsync(); |
214 using (GZipStream gzipStream = new GZipStream(stream, Compre
ssionMode.Decompress)) | 214 using (GZipStream gzipStream = new GZipStream(stream, Compre
ssionMode.Decompress)) |
215 { | 215 { |
216 strObject = ExtractStringFromStream(gzipStream); | 216 strObject = ExtractStringFromStream(gzipStream); |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get
DefaultETagAction(HttpConsts.Post)); | 1127 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get
DefaultETagAction(HttpConsts.Post)); |
1128 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get
DefaultETagAction(HttpConsts.Patch)); | 1128 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get
DefaultETagAction(HttpConsts.Patch)); |
1129 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get
DefaultETagAction(HttpConsts.Put)); | 1129 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get
DefaultETagAction(HttpConsts.Put)); |
1130 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get
DefaultETagAction(HttpConsts.Delete)); | 1130 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get
DefaultETagAction(HttpConsts.Delete)); |
1131 Assert.AreEqual(ETagAction.Ignore, ClientServiceRequest<object>.GetD
efaultETagAction("INVALID")); | 1131 Assert.AreEqual(ETagAction.Ignore, ClientServiceRequest<object>.GetD
efaultETagAction("INVALID")); |
1132 } | 1132 } |
1133 | 1133 |
1134 #endregion | 1134 #endregion |
1135 } | 1135 } |
1136 } | 1136 } |
LEFT | RIGHT |