Skip to content

Commit 0ee9a5d

Browse files
committed
added example
1 parent 42b6df4 commit 0ee9a5d

File tree

4 files changed

+180
-0
lines changed

4 files changed

+180
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>15.0</VCProjectVersion>
23+
<ProjectGuid>{6B741029-E951-4DCC-BD51-553EB6F8D14A}</ProjectGuid>
24+
<RootNamespace>requestsexample</RootNamespace>
25+
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
26+
</PropertyGroup>
27+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
28+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
29+
<ConfigurationType>Application</ConfigurationType>
30+
<UseDebugLibraries>true</UseDebugLibraries>
31+
<PlatformToolset>v141</PlatformToolset>
32+
<CharacterSet>MultiByte</CharacterSet>
33+
</PropertyGroup>
34+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
35+
<ConfigurationType>Application</ConfigurationType>
36+
<UseDebugLibraries>false</UseDebugLibraries>
37+
<PlatformToolset>v141</PlatformToolset>
38+
<WholeProgramOptimization>true</WholeProgramOptimization>
39+
<CharacterSet>MultiByte</CharacterSet>
40+
</PropertyGroup>
41+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
42+
<ConfigurationType>Application</ConfigurationType>
43+
<UseDebugLibraries>true</UseDebugLibraries>
44+
<PlatformToolset>v141</PlatformToolset>
45+
<CharacterSet>MultiByte</CharacterSet>
46+
</PropertyGroup>
47+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
48+
<ConfigurationType>Application</ConfigurationType>
49+
<UseDebugLibraries>false</UseDebugLibraries>
50+
<PlatformToolset>v141</PlatformToolset>
51+
<WholeProgramOptimization>true</WholeProgramOptimization>
52+
<CharacterSet>MultiByte</CharacterSet>
53+
</PropertyGroup>
54+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
55+
<ImportGroup Label="ExtensionSettings">
56+
</ImportGroup>
57+
<ImportGroup Label="Shared">
58+
</ImportGroup>
59+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
60+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
61+
</ImportGroup>
62+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
63+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
64+
</ImportGroup>
65+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
66+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
67+
</ImportGroup>
68+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
69+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
70+
</ImportGroup>
71+
<PropertyGroup Label="UserMacros" />
72+
<PropertyGroup />
73+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74+
<ClCompile>
75+
<WarningLevel>Level3</WarningLevel>
76+
<Optimization>Disabled</Optimization>
77+
<SDLCheck>true</SDLCheck>
78+
<ConformanceMode>true</ConformanceMode>
79+
</ClCompile>
80+
</ItemDefinitionGroup>
81+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
82+
<ClCompile>
83+
<WarningLevel>Level3</WarningLevel>
84+
<Optimization>Disabled</Optimization>
85+
<SDLCheck>true</SDLCheck>
86+
<ConformanceMode>true</ConformanceMode>
87+
</ClCompile>
88+
</ItemDefinitionGroup>
89+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
90+
<ClCompile>
91+
<WarningLevel>Level3</WarningLevel>
92+
<Optimization>MaxSpeed</Optimization>
93+
<FunctionLevelLinking>true</FunctionLevelLinking>
94+
<IntrinsicFunctions>true</IntrinsicFunctions>
95+
<SDLCheck>true</SDLCheck>
96+
<ConformanceMode>true</ConformanceMode>
97+
</ClCompile>
98+
<Link>
99+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
100+
<OptimizeReferences>true</OptimizeReferences>
101+
</Link>
102+
</ItemDefinitionGroup>
103+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
104+
<ClCompile>
105+
<WarningLevel>Level3</WarningLevel>
106+
<Optimization>MaxSpeed</Optimization>
107+
<FunctionLevelLinking>true</FunctionLevelLinking>
108+
<IntrinsicFunctions>true</IntrinsicFunctions>
109+
<SDLCheck>true</SDLCheck>
110+
<ConformanceMode>true</ConformanceMode>
111+
</ClCompile>
112+
<Link>
113+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
114+
<OptimizeReferences>true</OptimizeReferences>
115+
</Link>
116+
</ItemDefinitionGroup>
117+
<ItemGroup>
118+
<ClCompile Include="sample.cc" />
119+
</ItemGroup>
120+
<ItemGroup>
121+
<ProjectReference Include="..\requests\requests.vcxproj">
122+
<Project>{f8f68401-2068-4f78-9586-11a22299d4c1}</Project>
123+
</ProjectReference>
124+
</ItemGroup>
125+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
126+
<ImportGroup Label="ExtensionTargets">
127+
</ImportGroup>
128+
</Project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Arquivos de Origem">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Arquivos de Cabeçalho">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Arquivos de Recurso">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="sample.cc">
19+
<Filter>Arquivos de Origem</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
</Project>

requests.example/sample.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include "../requests/http.h"
2+
#include <cassert>
3+
4+
int main()
5+
{
6+
const Requests::post_data data = {
7+
{"foo","bar"}
8+
};
9+
10+
const auto g_res = Requests::get("httpbin.org/get");
11+
const auto p_res = Requests::post("httpbin.org/post", data);
12+
const auto nf_res = Requests::get("httpbin.org/404");
13+
14+
assert(g_res->status_code == "200 OK");
15+
assert(p_res->status_code == "200 OK");
16+
assert(nf_res->status_code == "404 NOT FOUND");
17+
18+
printf("That's all :D");
19+
20+
}

requests.sln

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.28010.2026
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "requests", "requests\requests.vcxproj", "{F8F68401-2068-4F78-9586-11A22299D4C1}"
77
EndProject
8+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "requests.example", "requests.example\requests.example.vcxproj", "{6B741029-E951-4DCC-BD51-553EB6F8D14A}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|x64 = Debug|x64
@@ -21,6 +23,14 @@ Global
2123
{F8F68401-2068-4F78-9586-11A22299D4C1}.Release|x64.Build.0 = Release|x64
2224
{F8F68401-2068-4F78-9586-11A22299D4C1}.Release|x86.ActiveCfg = Release|Win32
2325
{F8F68401-2068-4F78-9586-11A22299D4C1}.Release|x86.Build.0 = Release|Win32
26+
{6B741029-E951-4DCC-BD51-553EB6F8D14A}.Debug|x64.ActiveCfg = Debug|x64
27+
{6B741029-E951-4DCC-BD51-553EB6F8D14A}.Debug|x64.Build.0 = Debug|x64
28+
{6B741029-E951-4DCC-BD51-553EB6F8D14A}.Debug|x86.ActiveCfg = Debug|Win32
29+
{6B741029-E951-4DCC-BD51-553EB6F8D14A}.Debug|x86.Build.0 = Debug|Win32
30+
{6B741029-E951-4DCC-BD51-553EB6F8D14A}.Release|x64.ActiveCfg = Release|x64
31+
{6B741029-E951-4DCC-BD51-553EB6F8D14A}.Release|x64.Build.0 = Release|x64
32+
{6B741029-E951-4DCC-BD51-553EB6F8D14A}.Release|x86.ActiveCfg = Release|Win32
33+
{6B741029-E951-4DCC-BD51-553EB6F8D14A}.Release|x86.Build.0 = Release|Win32
2434
EndGlobalSection
2535
GlobalSection(SolutionProperties) = preSolution
2636
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)