Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added JavaScript version #3

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b46c5d3
Added JavaScript version
shmuelie Feb 22, 2013
140b14a
Fixed some bugs in JS version and added JS tests
shmuelie Feb 25, 2013
a3eeae5
Missed some files in last commit
shmuelie Feb 25, 2013
7a4dff3
Updated VSDoc and removed code that only made sense in C# version but…
shmuelie Feb 26, 2013
8fd9729
Added protection if 'callback' is not given
shmuelie Mar 7, 2013
c212edc
Updated JS docs
shmuelie Mar 7, 2013
5e8c333
[JS] Added ability to have credentials
shmuelie Mar 7, 2013
7bc0cc1
[JS] Added HttpStatusCode 'enum'
shmuelie Mar 7, 2013
f66ab39
[JS] Added better handling of error responses
shmuelie Mar 7, 2013
2ab20cd
[JS] Added more docs
shmuelie Mar 7, 2013
c49ab92
[JS] Added credentials to the client level too
shmuelie Mar 7, 2013
4a6c37a
[JS] spelled _credentials with a C once
shmuelie Mar 7, 2013
6f326a8
[JS] Fixed _getFormattedResource: While code did correctly copy C# ve…
shmuelie Mar 7, 2013
fd9b5d8
[JS] another spelling mistake
shmuelie Mar 7, 2013
6adb163
[JS] Made response callback code more robust
shmuelie Mar 7, 2013
2b4163e
[JS] Updated Docs
shmuelie Mar 7, 2013
b3c1b29
[JS] switched credential use so reqests overrides clients
shmuelie Mar 7, 2013
0f6c858
[JS] Changed client's credentials to be called default credentials
shmuelie Mar 7, 2013
13fef99
[JS] Changed ContentType to be string based instead of number based
shmuelie Mar 7, 2013
e2def10
Fixed bug where content failed to be parsed by JSON, crashing. Now it…
shmuelie Mar 7, 2013
c06e2ac
Code to deal with IE0013 from http://www.enhanceie.com/ie/bugs.asp
shmuelie Mar 7, 2013
b19a8c7
Update Docs
shmuelie Mar 7, 2013
755b0c3
Fixed bug where crashes in callback would result in callback being ca…
shmuelie Mar 8, 2013
413d402
Changed the XHR to be a function level variable intead of a private c…
shmuelie Mar 11, 2013
ddafeb4
Added Multipart-FormData support
shmuelie Mar 12, 2013
26f9b9a
Fixed problem in that you most likely can't set XHR's status field
shmuelie Mar 12, 2013
8018f11
removed passing ignoreRoot in constructor safety code
shmuelie Mar 12, 2013
84f1b07
removed double declaration of variables by combining some code
shmuelie Mar 12, 2013
9e55865
Added way to add execute listeners to the client directly
shmuelie Mar 18, 2013
6cf7104
Fixed naming issue. Renamed 'fireCallbackListeners' to '_fireCallback…
shmuelie Mar 25, 2013
da8fbc6
Fixed bug in calling 'callback' or general listeners
shmuelie Mar 25, 2013
bac9069
Changed callbacks so that they don't replace the 'this' on the callba…
shmuelie Mar 25, 2013
360cbe8
MERGE
shmuelie Jan 5, 2014
1580a1b
Added more function summary comments
shmuelie Jan 5, 2014
7ab986e
Added window.PortableRest.ParameterEncoding enumeration
shmuelie Jan 5, 2014
a315215
Added the ability to add an encoding to a parameter of a RestRequest
shmuelie Jan 5, 2014
94a4f9b
Updated Execute to look more like the C# code
shmuelie Jan 5, 2014
d74d76c
Fixed incorect VSDoc for PortableRest.RestRequest.AddParamter
shmuelie Apr 13, 2014
7b435c1
Added addQueryString method
shmuelie Apr 13, 2014
a88963f
[PortableRest.Js] Addedcode to process query string parameters
shmuelie Apr 13, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/PortableRest.Tests/PortableRest.Tests.csproj
Expand Up @@ -126,6 +126,8 @@
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.0-rc\tools\Microsoft.Bcl.Build.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
Expand Down
11 changes: 6 additions & 5 deletions src/PortableRest.Tests/packages.config
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.6" targetFramework="net451" />
<package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="net451" />
<package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="net451" />
<package id="Microsoft.Net.Http" version="2.2.18" targetFramework="net451" />
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="net451" />
<package id="HttpClient.Compression" version="1.0.0-beta4" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.14-rc" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.0-rc" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.1.3-beta" targetFramework="net45" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
<package id="Zlib.Portable" version="1.9.2" targetFramework="net45" />
</packages>
10 changes: 10 additions & 0 deletions src/PortableRest.sln
Expand Up @@ -19,6 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
PortableRest.nuspec = PortableRest.nuspec
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortableRestJs", "PortableRestJs\PortableRestJs.csproj", "{3D45C414-46FA-4427-8B6C-26C7DEDF40DC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -29,6 +31,14 @@ Global
{A3546D1A-CE87-49BB-800A-98018C1FCA00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3546D1A-CE87-49BB-800A-98018C1FCA00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3546D1A-CE87-49BB-800A-98018C1FCA00}.Release|Any CPU.Build.0 = Release|Any CPU
{500BCEAB-8F93-4BDE-84DB-D21147323837}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{500BCEAB-8F93-4BDE-84DB-D21147323837}.Debug|Any CPU.Build.0 = Debug|Any CPU
{500BCEAB-8F93-4BDE-84DB-D21147323837}.Release|Any CPU.ActiveCfg = Release|Any CPU
{500BCEAB-8F93-4BDE-84DB-D21147323837}.Release|Any CPU.Build.0 = Release|Any CPU
{3D45C414-46FA-4427-8B6C-26C7DEDF40DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D45C414-46FA-4427-8B6C-26C7DEDF40DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D45C414-46FA-4427-8B6C-26C7DEDF40DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D45C414-46FA-4427-8B6C-26C7DEDF40DC}.Release|Any CPU.Build.0 = Release|Any CPU
{EE7DCA96-146F-496B-9C8E-5368487DEE82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE7DCA96-146F-496B-9C8E-5368487DEE82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE7DCA96-146F-496B-9C8E-5368487DEE82}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
29 changes: 29 additions & 0 deletions src/PortableRest/PortableRest.csproj
Expand Up @@ -83,6 +83,34 @@
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.14-rc\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.14-rc\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\portable-net40+sl4+wp7+win8\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
<HintPath>..\packages\Microsoft.Net.Http.2.1.3-beta\lib\portable-net40+sl4+win8+wp71\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Compression">
<HintPath>..\packages\HttpClient.Compression.1.0.0-beta3\lib\portable-net4+sl4+wp7+win8\System.Net.Http.Compression.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\packages\Microsoft.Net.Http.2.1.3-beta\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives">
<HintPath>..\packages\Microsoft.Net.Http.2.1.3-beta\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Runtime">
<HintPath>..\packages\Microsoft.Bcl.1.0.16-rc\lib\portable-net40+sl4+win8+wp71\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.1.0.16-rc\lib\portable-net40+sl4+win8+wp71\System.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Zlib.Portable">
<HintPath>..\packages\Zlib.Portable.1.9.2\lib\portable-net4+sl4+wp71+win8\Zlib.Portable.dll</HintPath>
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
Expand Down Expand Up @@ -112,6 +140,7 @@
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.0-rc\tools\Microsoft.Bcl.Build.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
Expand Down
130 changes: 130 additions & 0 deletions src/PortableRestJs/PortableRestJs.csproj
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3D45C414-46FA-4427-8B6C-26C7DEDF40DC}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PortableRestJs</RootNamespace>
<AssemblyName>PortableRestJs</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Content Include="portableRest.js" />
<Content Include="test.aspx" />
<Content Include="test.html" />
<Content Include="Web.config" />
<Content Include="xmlTest.aspx" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="test.aspx.cs">
<DependentUpon>test.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="test.aspx.designer.cs">
<DependentUpon>test.aspx</DependentUpon>
</Compile>
<Compile Include="xmlTest.aspx.cs">
<DependentUpon>xmlTest.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="xmlTest.aspx.designer.cs">
<DependentUpon>xmlTest.aspx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="packages.config" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</None>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:56617/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
35 changes: 35 additions & 0 deletions src/PortableRestJs/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PortableRestJs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PortableRestJs")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f94e82b7-743c-4e6f-bf1d-fd1c7ea7a860")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
30 changes: 30 additions & 0 deletions src/PortableRestJs/Web.Debug.config
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
31 changes: 31 additions & 0 deletions src/PortableRestJs/Web.Release.config
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
13 changes: 13 additions & 0 deletions src/PortableRestJs/Web.config
@@ -0,0 +1,13 @@
<?xml version="1.0"?>

<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->

<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>

</configuration>