Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(830)

Delta Between Two Patch Sets: Src/GoogleApis.Tests/Apis/Requests/ClientServiceRequestTest.cs

Issue 13412046: Reimplement OAuth2 library - Step 1 (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Left Patch Set: Class comments Created 10 years, 6 months ago
Right Patch Set: minor Created 10 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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
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
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 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b