Skip to content

Commit 8ec8400

Browse files
committed
Merge branch 'master' of git://github.com/restsharp/RestSharp.git
2 parents 48524ed + 671d808 commit 8ec8400

13 files changed

+345
-14
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace RestSharp
7+
{
8+
public static partial class RestClientExtensions
9+
{
10+
public static RestResponse<dynamic> ExecuteDynamic(this IRestClient client, IRestRequest request)
11+
{
12+
var response = client.Execute(request);
13+
14+
var generic = (RestResponse<dynamic>)response;
15+
dynamic content = SimpleJson.DeserializeObject(response.Content);
16+
generic.Data = content;
17+
18+
return generic;
19+
}
20+
}
21+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("RestSharp")]
9+
10+
// Setting ComVisible to false makes the types in this assembly not visible
11+
// to COM components. If you need to access a type in this assembly from
12+
// COM, set the ComVisible attribute to true on that type.
13+
[assembly: ComVisible(false)]
14+
15+
// The following GUID is for the ID of the typelib if this project is exposed to COM
16+
[assembly: Guid("97044cbf-6c9d-4b08-87e3-bf30fbde1933")]
17+
18+
[assembly: InternalsVisibleTo("RestSharp.IntegrationTests")]
Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>RestSharp</RootNamespace>
12+
<AssemblyName>RestSharp</AssemblyName>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>TRACE;DEBUG;FRAMEWORK, NET4</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
<DocumentationFile>bin\Debug\RestSharp.xml</DocumentationFile>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE;FRAMEWORK, NET4</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
<DocumentationFile>bin\Release\RestSharp.xml</DocumentationFile>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
<Reference Include="System.Xml.Linq" />
39+
<Reference Include="System.Data.DataSetExtensions" />
40+
<Reference Include="Microsoft.CSharp" />
41+
<Reference Include="System.Data" />
42+
<Reference Include="System.Xml" />
43+
</ItemGroup>
44+
<ItemGroup>
45+
<Compile Include="..\restsharp\authenticators\HttpBasicAuthenticator.cs">
46+
<Link>Authenticators\HttpBasicAuthenticator.cs</Link>
47+
</Compile>
48+
<Compile Include="..\restsharp\authenticators\IAuthenticator.cs">
49+
<Link>Authenticators\IAuthenticator.cs</Link>
50+
</Compile>
51+
<Compile Include="..\restsharp\authenticators\NtlmAuthenticator.cs">
52+
<Link>Authenticators\NtlmAuthenticator.cs</Link>
53+
</Compile>
54+
<Compile Include="..\restsharp\authenticators\OAuth2Authenticator.cs">
55+
<Link>Authenticators\OAuth2Authenticator.cs</Link>
56+
</Compile>
57+
<Compile Include="..\restsharp\authenticators\oauth\extensions\CollectionExtensions.cs">
58+
<Link>Authenticators\OAuth\Extensions\CollectionExtensions.cs</Link>
59+
</Compile>
60+
<Compile Include="..\restsharp\authenticators\oauth\extensions\OAuthExtensions.cs">
61+
<Link>Authenticators\OAuth\Extensions\OAuthExtensions.cs</Link>
62+
</Compile>
63+
<Compile Include="..\restsharp\authenticators\oauth\extensions\StringExtensions.cs">
64+
<Link>Authenticators\OAuth\Extensions\StringExtensions.cs</Link>
65+
</Compile>
66+
<Compile Include="..\restsharp\authenticators\oauth\extensions\TimeExtensions.cs">
67+
<Link>Authenticators\OAuth\Extensions\TimeExtensions.cs</Link>
68+
</Compile>
69+
<Compile Include="..\restsharp\authenticators\oauth\HttpPostParameter.cs">
70+
<Link>Authenticators\OAuth\HttpPostParameter.cs</Link>
71+
</Compile>
72+
<Compile Include="..\restsharp\authenticators\oauth\HttpPostParameterType.cs">
73+
<Link>Authenticators\OAuth\HttpPostParameterType.cs</Link>
74+
</Compile>
75+
<Compile Include="..\restsharp\authenticators\oauth\OAuthParameterHandling.cs">
76+
<Link>Authenticators\OAuth\OAuthParameterHandling.cs</Link>
77+
</Compile>
78+
<Compile Include="..\restsharp\authenticators\oauth\OAuthSignatureMethod.cs">
79+
<Link>Authenticators\OAuth\OAuthSignatureMethod.cs</Link>
80+
</Compile>
81+
<Compile Include="..\restsharp\authenticators\oauth\OAuthSignatureTreatment.cs">
82+
<Link>Authenticators\OAuth\OAuthSignatureTreatment.cs</Link>
83+
</Compile>
84+
<Compile Include="..\restsharp\authenticators\oauth\OAuthTools.cs">
85+
<Link>Authenticators\OAuth\OAuthTools.cs</Link>
86+
</Compile>
87+
<Compile Include="..\restsharp\authenticators\oauth\OAuthType.cs">
88+
<Link>Authenticators\OAuth\OAuthType.cs</Link>
89+
</Compile>
90+
<Compile Include="..\restsharp\authenticators\oauth\OAuthWebQueryInfo.cs">
91+
<Link>Authenticators\OAuth\OAuthWebQueryInfo.cs</Link>
92+
</Compile>
93+
<Compile Include="..\restsharp\authenticators\oauth\OAuthWorkflow.cs">
94+
<Link>Authenticators\OAuth\OAuthWorkflow.cs</Link>
95+
</Compile>
96+
<Compile Include="..\restsharp\authenticators\oauth\WebPair.cs">
97+
<Link>Authenticators\OAuth\WebPair.cs</Link>
98+
</Compile>
99+
<Compile Include="..\restsharp\authenticators\oauth\WebPairCollection.cs">
100+
<Link>Authenticators\OAuth\WebPairCollection.cs</Link>
101+
</Compile>
102+
<Compile Include="..\restsharp\authenticators\oauth\WebParameter.cs">
103+
<Link>Authenticators\OAuth\WebParameter.cs</Link>
104+
</Compile>
105+
<Compile Include="..\restsharp\authenticators\oauth\WebParameterCollection.cs">
106+
<Link>Authenticators\OAuth\WebParameterCollection.cs</Link>
107+
</Compile>
108+
<Compile Include="..\restsharp\authenticators\SimpleAuthenticator.cs">
109+
<Link>Authenticators\SimpleAuthenticator.cs</Link>
110+
</Compile>
111+
<Compile Include="..\restsharp\deserializers\DeserializeAsAttribute.cs">
112+
<Link>Deserializers\DeserializeAsAttribute.cs</Link>
113+
</Compile>
114+
<Compile Include="..\restsharp\deserializers\DotNetXmlDeserializer.cs">
115+
<Link>Deserializers\DotNetXmlDeserializer.cs</Link>
116+
</Compile>
117+
<Compile Include="..\restsharp\deserializers\IDeserializer.cs">
118+
<Link>Deserializers\IDeserializer.cs</Link>
119+
</Compile>
120+
<Compile Include="..\restsharp\deserializers\JsonDeserializer.cs">
121+
<Link>Deserializers\JsonDeserializer.cs</Link>
122+
</Compile>
123+
<Compile Include="..\restsharp\deserializers\XmlAttributeDeserializer.cs">
124+
<Link>Deserializers\XmlAttributeDeserializer.cs</Link>
125+
</Compile>
126+
<Compile Include="..\restsharp\deserializers\XmlDeserializer.cs">
127+
<Link>Deserializers\XmlDeserializer.cs</Link>
128+
</Compile>
129+
<Compile Include="..\RestSharp\Enum.cs">
130+
<Link>Enum.cs</Link>
131+
</Compile>
132+
<Compile Include="..\restsharp\extensions\MiscExtensions.cs">
133+
<Link>Extensions\MiscExtensions.cs</Link>
134+
</Compile>
135+
<Compile Include="..\RestSharp\Extensions\MonoHttp\Helpers.cs">
136+
<Link>Extensions\MonoHttp\Helpers.cs</Link>
137+
</Compile>
138+
<Compile Include="..\RestSharp\Extensions\MonoHttp\HtmlEncoder.cs">
139+
<Link>Extensions\MonoHttp\HtmlEncoder.cs</Link>
140+
</Compile>
141+
<Compile Include="..\RestSharp\Extensions\MonoHttp\HttpUtility.cs">
142+
<Link>Extensions\MonoHttp\HttpUtility.cs</Link>
143+
</Compile>
144+
<Compile Include="..\restsharp\extensions\ReflectionExtensions.cs">
145+
<Link>Extensions\ReflectionExtensions.cs</Link>
146+
</Compile>
147+
<Compile Include="..\restsharp\extensions\ResponseExtensions.cs">
148+
<Link>Extensions\ResponseExtensions.cs</Link>
149+
</Compile>
150+
<Compile Include="..\restsharp\extensions\StringExtensions.cs">
151+
<Link>Extensions\StringExtensions.cs</Link>
152+
</Compile>
153+
<Compile Include="..\restsharp\extensions\XmlExtensions.cs">
154+
<Link>Extensions\XmlExtensions.cs</Link>
155+
</Compile>
156+
<Compile Include="..\RestSharp\FileParameter.cs">
157+
<Link>FileParameter.cs</Link>
158+
</Compile>
159+
<Compile Include="..\RestSharp\Http.Async.cs">
160+
<Link>Http.Async.cs</Link>
161+
</Compile>
162+
<Compile Include="..\RestSharp\Http.cs">
163+
<Link>Http.cs</Link>
164+
</Compile>
165+
<Compile Include="..\RestSharp\Http.Sync.cs">
166+
<Link>Http.Sync.cs</Link>
167+
</Compile>
168+
<Compile Include="..\RestSharp\HttpCookie.cs">
169+
<Link>HttpCookie.cs</Link>
170+
</Compile>
171+
<Compile Include="..\RestSharp\HttpFile.cs">
172+
<Link>HttpFile.cs</Link>
173+
</Compile>
174+
<Compile Include="..\RestSharp\HttpHeader.cs">
175+
<Link>HttpHeader.cs</Link>
176+
</Compile>
177+
<Compile Include="..\RestSharp\HttpParameter.cs">
178+
<Link>HttpParameter.cs</Link>
179+
</Compile>
180+
<Compile Include="..\RestSharp\HttpResponse.cs">
181+
<Link>HttpResponse.cs</Link>
182+
</Compile>
183+
<Compile Include="..\RestSharp\IHttp.cs">
184+
<Link>IHttp.cs</Link>
185+
</Compile>
186+
<Compile Include="..\RestSharp\IHttpFactory.cs">
187+
<Link>IHttpFactory.cs</Link>
188+
</Compile>
189+
<Compile Include="..\RestSharp\IHttpResponse.cs">
190+
<Link>IHttpResponse.cs</Link>
191+
</Compile>
192+
<Compile Include="..\RestSharp\IRestClient.cs">
193+
<Link>IRestClient.cs</Link>
194+
</Compile>
195+
<Compile Include="..\RestSharp\IRestRequest.cs">
196+
<Link>IRestRequest.cs</Link>
197+
</Compile>
198+
<Compile Include="..\RestSharp\IRestResponse.cs">
199+
<Link>IRestResponse.cs</Link>
200+
</Compile>
201+
<Compile Include="..\RestSharp\Parameter.cs">
202+
<Link>Parameter.cs</Link>
203+
</Compile>
204+
<Compile Include="..\RestSharp\RestClient.Async.cs">
205+
<Link>RestClient.Async.cs</Link>
206+
</Compile>
207+
<Compile Include="..\RestSharp\RestClient.cs">
208+
<Link>RestClient.cs</Link>
209+
</Compile>
210+
<Compile Include="..\RestSharp\RestClient.Sync.cs">
211+
<Link>RestClient.Sync.cs</Link>
212+
</Compile>
213+
<Compile Include="..\RestSharp\RestClientExtensions.cs">
214+
<Link>RestClientExtensions.cs</Link>
215+
</Compile>
216+
<Compile Include="..\RestSharp\RestRequest.cs">
217+
<Link>RestRequest.cs</Link>
218+
</Compile>
219+
<Compile Include="..\RestSharp\RestRequestAsyncHandle.cs">
220+
<Link>RestRequestAsyncHandle.cs</Link>
221+
</Compile>
222+
<Compile Include="..\RestSharp\RestResponse.cs">
223+
<Link>RestResponse.cs</Link>
224+
</Compile>
225+
<Compile Include="..\RestSharp\RestResponseCookie.cs">
226+
<Link>RestResponseCookie.cs</Link>
227+
</Compile>
228+
<Compile Include="..\restsharp\serializers\DotNetXmlSerializer.cs">
229+
<Link>Serializers\DotNetXmlSerializer.cs</Link>
230+
</Compile>
231+
<Compile Include="..\restsharp\serializers\ISerializer.cs">
232+
<Link>Serializers\ISerializer.cs</Link>
233+
</Compile>
234+
<Compile Include="..\restsharp\serializers\JsonSerializer.cs">
235+
<Link>Serializers\JsonSerializer.cs</Link>
236+
</Compile>
237+
<Compile Include="..\restsharp\serializers\SerializeAsAttribute.cs">
238+
<Link>Serializers\SerializeAsAttribute.cs</Link>
239+
</Compile>
240+
<Compile Include="..\restsharp\serializers\XmlSerializer.cs">
241+
<Link>Serializers\XmlSerializer.cs</Link>
242+
</Compile>
243+
<Compile Include="..\RestSharp\SharedAssemblyInfo.cs">
244+
<Link>SharedAssemblyInfo.cs</Link>
245+
</Compile>
246+
<Compile Include="..\RestSharp\SimpleJson.cs">
247+
<Link>SimpleJson.cs</Link>
248+
</Compile>
249+
<Compile Include="..\restsharp\validation\Require.cs">
250+
<Link>Validation\Require.cs</Link>
251+
</Compile>
252+
<Compile Include="..\restsharp\validation\Validate.cs">
253+
<Link>Validation\Validate.cs</Link>
254+
</Compile>
255+
<Compile Include="Extensions\RestClientExtensions.cs" />
256+
<Compile Include="Properties\AssemblyInfo.cs" />
257+
</ItemGroup>
258+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
259+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
260+
Other similar extension points exist, see Microsoft.Common.targets.
261+
<Target Name="BeforeBuild">
262+
</Target>
263+
<Target Name="AfterBuild">
264+
</Target>
265+
-->
266+
</Project>

RestSharp.sln

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{E709A928
1919
restsharp.nuspec = restsharp.nuspec
2020
EndProjectSection
2121
EndProject
22+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RestSharp.Net4", "RestSharp.Net4\RestSharp.Net4.csproj", "{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}"
23+
EndProject
2224
Global
2325
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2426
Debug|Any CPU = Debug|Any CPU
@@ -79,6 +81,16 @@ Global
7981
{F4D48DF6-316E-4963-B5C1-59CA39B431B7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
8082
{F4D48DF6-316E-4963-B5C1-59CA39B431B7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
8183
{F4D48DF6-316E-4963-B5C1-59CA39B431B7}.Release|x86.ActiveCfg = Release|Any CPU
84+
{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
85+
{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
86+
{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
87+
{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
88+
{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}.Debug|x86.ActiveCfg = Debug|Any CPU
89+
{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
90+
{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}.Release|Any CPU.Build.0 = Release|Any CPU
91+
{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
92+
{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
93+
{5FF943A5-260F-4042-B4CE-C4977BAD4EBB}.Release|x86.ActiveCfg = Release|Any CPU
8294
EndGlobalSection
8395
GlobalSection(SolutionProperties) = preSolution
8496
HideSolutionNode = FALSE

RestSharp/Extensions/ResponseExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace RestSharp.Extensions
77
{
88
public static class ResponseExtensions
99
{
10-
public static IRestResponse<T> toAsyncResponse<T>(this IRestResponse response) where T : new()
10+
public static IRestResponse<T> toAsyncResponse<T>(this IRestResponse response)
1111
{
1212
return new RestResponse<T>
1313
{

RestSharp/IRestClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public interface IRestClient
6363
///
6464
/// </summary>
6565
/// <param name="request"></param>
66-
RestRequestAsyncHandle ExecuteAsync<T>(IRestRequest request, Action<IRestResponse<T>, RestRequestAsyncHandle> callback) where T : new();
66+
RestRequestAsyncHandle ExecuteAsync<T>(IRestRequest request, Action<IRestResponse<T>, RestRequestAsyncHandle> callback);
6767

6868
#if FRAMEWORK
6969
/// <summary>

RestSharp/RestClient.Async.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ private void ProcessResponse(HttpResponse httpResponse, RestRequestAsyncHandle a
9494
/// <typeparam name="T">Target deserialization type</typeparam>
9595
/// <param name="request">Request to be executed</param>
9696
/// <param name="callback">Callback function to be executed upon completion</param>
97-
public virtual RestRequestAsyncHandle ExecuteAsync<T>(IRestRequest request, Action<IRestResponse<T>, RestRequestAsyncHandle> callback) where T : new()
97+
public virtual RestRequestAsyncHandle ExecuteAsync<T>(IRestRequest request, Action<IRestResponse<T>, RestRequestAsyncHandle> callback)
9898
{
9999
return ExecuteAsync(request, (response, asyncHandle) =>
100100
{
101-
var restResponse = (IRestResponse<T>)response;
101+
IRestResponse<T> restResponse = response as RestResponse<T>;
102102
if (response.ResponseStatus != ResponseStatus.Aborted)
103103
{
104104
restResponse = Deserialize<T>(request, response);

RestSharp/RestClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ private RestResponse ConvertToRestResponse(HttpResponse httpResponse)
488488
return restResponse;
489489
}
490490

491-
private IRestResponse<T> Deserialize<T>(IRestRequest request, IRestResponse raw) where T : new()
491+
private IRestResponse<T> Deserialize<T>(IRestRequest request, IRestResponse raw)
492492
{
493493
request.OnBeforeDeserialization(raw);
494494

RestSharp/RestClientExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace RestSharp
44
{
5-
public static class RestClientExtensions
5+
public static partial class RestClientExtensions
66
{
77
/// <summary>
88
/// Executes the request and callback asynchronously, authenticating if needed

0 commit comments

Comments
 (0)