Skip to content

Commit bade8c3

Browse files
committed
Fix spaces vs tabs.
1 parent ca7e25c commit bade8c3

File tree

7 files changed

+458
-460
lines changed

7 files changed

+458
-460
lines changed

RestSharp/Enum.cs

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,82 @@
1-
#region License
2-
// Copyright 2010 John Sheehan
3-
//
4-
// Licensed under the Apache License, Version 2.0 (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
7-
//
8-
// http://www.apache.org/licenses/LICENSE-2.0
9-
//
10-
// Unless required by applicable law or agreed to in writing, software
11-
// distributed under the License is distributed on an "AS IS" BASIS,
12-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
// See the License for the specific language governing permissions and
14-
// limitations under the License.
15-
#endregion
16-
17-
namespace RestSharp
18-
{
19-
///<summary>
20-
/// Types of parameters that can be added to requests
21-
///</summary>
22-
public enum ParameterType
23-
{
24-
Cookie,
25-
GetOrPost,
26-
UrlSegment,
27-
HttpHeader,
28-
RequestBody,
29-
QueryString
30-
}
31-
32-
/// <summary>
33-
/// Data formats
34-
/// </summary>
35-
public enum DataFormat
36-
{
37-
Json,
38-
Xml
39-
}
40-
41-
/// <summary>
42-
/// HTTP method to use when making requests
43-
/// </summary>
44-
public enum Method
45-
{
46-
GET,
47-
POST,
48-
PUT,
49-
DELETE,
50-
HEAD,
51-
OPTIONS,
52-
PATCH,
53-
MERGE,
54-
}
55-
56-
/// <summary>
57-
/// Format strings for commonly-used date formats
58-
/// </summary>
59-
public struct DateFormat
60-
{
61-
/// <summary>
62-
/// .NET format string for ISO 8601 date format
63-
/// </summary>
64-
public const string Iso8601 = "s";
65-
/// <summary>
66-
/// .NET format string for roundtrip date format
67-
/// </summary>
68-
public const string RoundTrip = "u";
69-
}
70-
71-
/// <summary>
72-
/// Status for responses (surprised?)
73-
/// </summary>
74-
public enum ResponseStatus
75-
{
76-
None,
77-
Completed,
78-
Error,
79-
TimedOut,
80-
Aborted
81-
}
82-
}
1+
#region License
2+
// Copyright 2010 John Sheehan
3+
//
4+
// Licensed under the Apache License, Version 2.0 (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
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
#endregion
16+
17+
namespace RestSharp
18+
{
19+
///<summary>
20+
/// Types of parameters that can be added to requests
21+
///</summary>
22+
public enum ParameterType
23+
{
24+
Cookie,
25+
GetOrPost,
26+
UrlSegment,
27+
HttpHeader,
28+
RequestBody,
29+
QueryString
30+
}
31+
32+
/// <summary>
33+
/// Data formats
34+
/// </summary>
35+
public enum DataFormat
36+
{
37+
Json,
38+
Xml
39+
}
40+
41+
/// <summary>
42+
/// HTTP method to use when making requests
43+
/// </summary>
44+
public enum Method
45+
{
46+
GET,
47+
POST,
48+
PUT,
49+
DELETE,
50+
HEAD,
51+
OPTIONS,
52+
PATCH,
53+
MERGE,
54+
}
55+
56+
/// <summary>
57+
/// Format strings for commonly-used date formats
58+
/// </summary>
59+
public struct DateFormat
60+
{
61+
/// <summary>
62+
/// .NET format string for ISO 8601 date format
63+
/// </summary>
64+
public const string Iso8601 = "s";
65+
/// <summary>
66+
/// .NET format string for roundtrip date format
67+
/// </summary>
68+
public const string RoundTrip = "u";
69+
}
70+
71+
/// <summary>
72+
/// Status for responses (surprised?)
73+
/// </summary>
74+
public enum ResponseStatus
75+
{
76+
None,
77+
Completed,
78+
Error,
79+
TimedOut,
80+
Aborted
81+
}
82+
}

RestSharp/Http.Async.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
using System.Threading;
2020
using RestSharp.Extensions;
2121

22-
#if SILVERLIGHT
23-
using System.Windows.Browser;
24-
using System.Net.Browser;
22+
#if SILVERLIGHT
23+
using System.Windows.Browser;
24+
using System.Net.Browser;
2525
#endif
2626

27-
#if WINDOWS_PHONE
28-
using System.Windows.Threading;
29-
using System.Windows;
27+
#if WINDOWS_PHONE
28+
using System.Windows.Threading;
29+
using System.Windows;
3030
#endif
3131

3232
#if (FRAMEWORK && !MONOTOUCH && !MONODROID && !PocketPC)
@@ -89,8 +89,8 @@ public HttpWebRequest MergeAsync(Action<HttpResponse> action)
8989
/// <returns></returns>
9090
public HttpWebRequest AsPostAsync(Action<HttpResponse> action, string httpMethod)
9191
{
92-
#if PocketPC
93-
return PutPostInternalAsync(httpMethod.ToUpper(), action);
92+
#if PocketPC
93+
return PutPostInternalAsync(httpMethod.ToUpper(), action);
9494
#else
9595
return PutPostInternalAsync(httpMethod.ToUpperInvariant(), action);
9696
#endif
@@ -103,8 +103,8 @@ public HttpWebRequest AsPostAsync(Action<HttpResponse> action, string httpMethod
103103
/// <returns></returns>
104104
public HttpWebRequest AsGetAsync(Action<HttpResponse> action, string httpMethod)
105105
{
106-
#if PocketPC
107-
return GetStyleMethodInternalAsync(httpMethod.ToUpper(), action);
106+
#if PocketPC
107+
return GetStyleMethodInternalAsync(httpMethod.ToUpper(), action);
108108
#else
109109
return GetStyleMethodInternalAsync(httpMethod.ToUpperInvariant(), action);
110110
#endif
@@ -362,23 +362,23 @@ private static void ExecuteCallback(HttpResponse response, Action<HttpResponse>
362362

363363
partial void AddAsyncHeaderActions()
364364
{
365-
#if SILVERLIGHT
366-
_restrictedHeaderActions.Add("Content-Length", (r, v) => r.ContentLength = Convert.ToInt64(v));
365+
#if SILVERLIGHT
366+
_restrictedHeaderActions.Add("Content-Length", (r, v) => r.ContentLength = Convert.ToInt64(v));
367367
#endif
368-
#if WINDOWS_PHONE
369-
// WP7 doesn't as of Beta doesn't support a way to set Content-Length either directly
370-
// or indirectly
371-
_restrictedHeaderActions.Add("Content-Length", (r, v) => { });
368+
#if WINDOWS_PHONE
369+
// WP7 doesn't as of Beta doesn't support a way to set Content-Length either directly
370+
// or indirectly
371+
_restrictedHeaderActions.Add("Content-Length", (r, v) => { });
372372
#endif
373373
}
374374

375375
// TODO: Try to merge the shared parts between ConfigureWebRequest and ConfigureAsyncWebRequest (quite a bit of code
376376
// TODO: duplication at the moment).
377377
private HttpWebRequest ConfigureAsyncWebRequest(string method, Uri url)
378378
{
379-
#if SILVERLIGHT
380-
WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
381-
WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
379+
#if SILVERLIGHT
380+
WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
381+
WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
382382
#endif
383383
var webRequest = (HttpWebRequest)WebRequest.Create(url);
384384
#if !PocketPC
@@ -457,4 +457,4 @@ private class TimeOutState
457457
public HttpWebRequest Request { get; set; }
458458
}
459459
}
460-
}
460+
}

RestSharp/Http.Sync.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ public HttpResponse Merge()
102102
/// <returns></returns>
103103
public HttpResponse AsGet(string httpMethod)
104104
{
105-
#if PocketPC
106-
return GetStyleMethodInternal(httpMethod.ToUpper());
105+
#if PocketPC
106+
return GetStyleMethodInternal(httpMethod.ToUpper());
107107
#else
108108
return GetStyleMethodInternal(httpMethod.ToUpperInvariant());
109109
#endif
@@ -116,8 +116,8 @@ public HttpResponse AsGet(string httpMethod)
116116
/// <returns></returns>
117117
public HttpResponse AsPost(string httpMethod)
118118
{
119-
#if PocketPC
120-
return PostPutInternal(httpMethod.ToUpper());
119+
#if PocketPC
120+
return PostPutInternal(httpMethod.ToUpper());
121121
#else
122122
return PostPutInternal(httpMethod.ToUpperInvariant());
123123
#endif

RestSharp/Http.cs

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
using System.Text;
2424
using RestSharp.Extensions;
2525

26-
#if WINDOWS_PHONE
27-
using RestSharp.Compression.ZLib;
26+
#if WINDOWS_PHONE
27+
using RestSharp.Compression.ZLib;
2828
#endif
2929

3030
namespace RestSharp
@@ -178,9 +178,7 @@ protected bool HasFiles
178178
/// URL to call for this request
179179
/// </summary>
180180
public Uri Url { get; set; }
181-
/// <summary>
182-
/// Flag to send authorisation header with the HttpWebRequest
183-
/// </summary>
181+
184182
public bool PreAuthenticate { get; set; }
185183

186184
#if FRAMEWORK || PocketPC
@@ -212,16 +210,16 @@ private void AddSharedHeaderActions()
212210
{
213211
_restrictedHeaderActions.Add("Accept", (r, v) => r.Accept = v);
214212
_restrictedHeaderActions.Add("Content-Type", (r, v) => r.ContentType = v);
215-
#if NET4
216-
_restrictedHeaderActions.Add("Date", (r, v) =>
217-
{
218-
DateTime parsed;
219-
if (DateTime.TryParse(v, out parsed))
220-
{
221-
r.Date = parsed;
222-
}
223-
});
224-
_restrictedHeaderActions.Add("Host", (r, v) => r.Host = v);
213+
#if NET4
214+
_restrictedHeaderActions.Add("Date", (r, v) =>
215+
{
216+
DateTime parsed;
217+
if (DateTime.TryParse(v, out parsed))
218+
{
219+
r.Date = parsed;
220+
}
221+
});
222+
_restrictedHeaderActions.Add("Host", (r, v) => r.Host = v);
225223
#else
226224
_restrictedHeaderActions.Add("Date", (r, v) => { /* Set by system */ });
227225
_restrictedHeaderActions.Add("Host", (r, v) => { /* Set by system */ });
@@ -270,8 +268,8 @@ private void AppendHeaders(HttpWebRequest webRequest)
270268
{
271269
#if FRAMEWORK
272270
webRequest.Headers.Add(header.Name, header.Value);
273-
#else
274-
webRequest.Headers[header.Name] = header.Value;
271+
#else
272+
webRequest.Headers[header.Name] = header.Value;
275273
#endif
276274
}
277275
}
@@ -293,14 +291,14 @@ private void AppendCookies(HttpWebRequest webRequest)
293291
Domain = webRequest.RequestUri.Host
294292
};
295293
webRequest.CookieContainer.Add(cookie);
296-
#else
297-
var cookie = new Cookie
298-
{
299-
Name = httpCookie.Name,
300-
Value = httpCookie.Value
301-
};
302-
var uri = webRequest.RequestUri;
303-
webRequest.CookieContainer.Add(new Uri(string.Format("{0}://{1}", uri.Scheme, uri.Host)), cookie);
294+
#else
295+
var cookie = new Cookie
296+
{
297+
Name = httpCookie.Name,
298+
Value = httpCookie.Value
299+
};
300+
var uri = webRequest.RequestUri;
301+
webRequest.CookieContainer.Add(new Uri(string.Format("{0}://{1}", uri.Scheme, uri.Host)), cookie);
304302
#endif
305303
#endif
306304
}
@@ -373,16 +371,16 @@ private void ExtractResponseData(HttpResponse response, HttpWebResponse webRespo
373371
response.ContentType = webResponse.ContentType;
374372
response.ContentLength = webResponse.ContentLength;
375373
Stream webResponseStream = webResponse.GetResponseStream();
376-
#if WINDOWS_PHONE
377-
if (String.Equals(webResponse.Headers[HttpRequestHeader.ContentEncoding], "gzip", StringComparison.OrdinalIgnoreCase))
378-
{
379-
var gzStream = new GZipStream(webResponseStream);
380-
ProcessResponseStream(gzStream, response);
381-
}
382-
else
383-
{
384-
ProcessResponseStream(webResponseStream, response);
385-
}
374+
#if WINDOWS_PHONE
375+
if (String.Equals(webResponse.Headers[HttpRequestHeader.ContentEncoding], "gzip", StringComparison.OrdinalIgnoreCase))
376+
{
377+
var gzStream = new GZipStream(webResponseStream);
378+
ProcessResponseStream(gzStream, response);
379+
}
380+
else
381+
{
382+
ProcessResponseStream(webResponseStream, response);
383+
}
386384
#else
387385
ProcessResponseStream(webResponseStream, response);
388386
#endif

0 commit comments

Comments
 (0)