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

Delta Between Two Patch Sets: Src/GoogleApis/Apis/Http/HttpExtenstions.cs

Issue 13412046: Reimplement OAuth2 library - Step 1 (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Left Patch Set: minor 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 2013 Google Inc 2 Copyright 2013 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
11 distributed under the License is distributed on an "AS IS" BASIS, 11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and 13 See the License for the specific language governing permissions and
14 limitations under the License. 14 limitations under the License.
15 */ 15 */
16 16
17 using System.Net; 17 using System.Net;
18 using System.Net.Http; 18 using System.Net.Http;
19 19
20 namespace Google.Apis.Http 20 namespace Google.Apis.Http
21 { 21 {
22 /// <summary> 22 /// <summary>
23 /// Extension methods to <see cref="System.Net.Http.HttpRequestMessage"/> an d· 23 /// Extension methods to <see cref="System.Net.Http.HttpRequestMessage"/> an d·
24 /// <see cref="System.Net.Http.HttpResponseMessage"/>. 24 /// <see cref="System.Net.Http.HttpResponseMessage"/>.
25 /// </summary> 25 /// </summary>
26 static class HttpExtenstions 26 static class HttpExtenstions
27 { 27 {
28 /// <summary> Returns <c>true</c> if the response contains one of the re direct status codes. </summary> 28 /// <summary>Returns <c>true</c> if the response contains one of the red irect status codes.</summary>
29 public static bool IsRedirectStatusCode(this HttpResponseMessage message ) 29 public static bool IsRedirectStatusCode(this HttpResponseMessage message )
30 { 30 {
31 switch (message.StatusCode) 31 switch (message.StatusCode)
32 { 32 {
33 case HttpStatusCode.Moved: 33 case HttpStatusCode.Moved:
34 case HttpStatusCode.Redirect: 34 case HttpStatusCode.Redirect:
35 case HttpStatusCode.RedirectMethod: 35 case HttpStatusCode.RedirectMethod:
36 case HttpStatusCode.TemporaryRedirect: 36 case HttpStatusCode.TemporaryRedirect:
37 return true; 37 return true;
38 default: 38 default:
39 return false; 39 return false;
40 } 40 }
41 } 41 }
42 42
43 /// <summary> Sets an empty HTTP content. </summary> 43 /// <summary>Sets an empty HTTP content.</summary>
class 2013/09/16 23:47:29 Spacing on <summary>
peleyal 2013/09/17 15:53:40 Done.
44 public static HttpContent SetEmptyContent(this HttpRequestMessage reques t) 44 public static HttpContent SetEmptyContent(this HttpRequestMessage reques t)
45 { 45 {
46 request.Content = new ByteArrayContent(new byte[0]); 46 request.Content = new ByteArrayContent(new byte[0]);
47 request.Content.Headers.ContentLength = 0; 47 request.Content.Headers.ContentLength = 0;
48 return request.Content; 48 return request.Content;
49 } 49 }
50 } 50 }
51 } 51 }
LEFTRIGHT

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