Skip to content

Merge develop to master #6

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

Merged
merged 6 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions HttpClient.Caching/HttpClient.Caching.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netstandard1.2</TargetFrameworks>
<TargetFrameworks>net45;netstandard1.2;netstandard2.0</TargetFrameworks>
<Authors>Thomas Galliker</Authors>
<Company>superdev GmbH</Company>
<Description>HttpClient.Caching adds http response caching to HttpClient.</Description>
<Copyright>Copyright 2018</Copyright>
<Copyright>Copyright 2020</Copyright>
<PackageProjectUrl>https://github.com/thomasgalliker/HttpClient.Caching</PackageProjectUrl>
<PackageIconUrl>https://raw.githubusercontent.com/thomasgalliker/HttpClient.Caching/master/logo.png</PackageIconUrl>
<RepositoryUrl>https://github.com/thomasgalliker/HttpClient.Caching</RepositoryUrl>
Expand All @@ -16,12 +16,12 @@
<NeutralLanguage>en</NeutralLanguage>
<RootNamespace>Microsoft.Extensions.Caching</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,23 @@ static void Main(string[] args)
}
```

Console output:
```
Attempt 1: HTTP GET http://worldclockapi.com/api/json/utc/now... completed in 625ms
Attempt 2: HTTP GET http://worldclockapi.com/api/json/utc/now... completed in 48ms
Attempt 3: HTTP GET http://worldclockapi.com/api/json/utc/now... completed in 1ms
Attempt 4: HTTP GET http://worldclockapi.com/api/json/utc/now... completed in 1ms
Attempt 5: HTTP GET http://worldclockapi.com/api/json/utc/now... completed in 1ms

TotalRequests: 5
-> CacheHit: 4
-> CacheMiss: 1
```



### Further Reading
[How-to: HTTP Caching for RESTful & Hypermedia APIs](https://www.apiacademy.co/articles/2015/12/how-to-http-caching-for-restful-hypermedia-apis)

### License
This project is Copyright &copy; 2018 [Thomas Galliker](https://ch.linkedin.com/in/thomasgalliker). Free for non-commercial use. For commercial use please contact the author.
This project is Copyright &copy; 2020 [Thomas Galliker](https://ch.linkedin.com/in/thomasgalliker). Free for non-commercial use. For commercial use please contact the author.
2 changes: 1 addition & 1 deletion Samples/ConsoleAppSample/ConsoleAppSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 9 additions & 1 deletion Samples/WpfSample/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.5.0" newVersion="2.0.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
12 changes: 6 additions & 6 deletions Samples/WpfSample/WpfSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CommonServiceLocator, Version=2.0.2.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>..\..\packages\CommonServiceLocator.2.0.2\lib\net47\CommonServiceLocator.dll</HintPath>
<Reference Include="CommonServiceLocator, Version=2.0.5.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>..\..\packages\CommonServiceLocator.2.0.5\lib\net47\CommonServiceLocator.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight, Version=5.4.1.0, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
<HintPath>..\..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
Expand All @@ -47,8 +47,8 @@
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
<HintPath>..\..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
Expand All @@ -64,8 +64,8 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Tracing, Version=2.0.18322.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Tracing.2.0.18322.5-pre\lib\net45\Tracing.dll</HintPath>
<Reference Include="Tracing, Version=2.2.19302.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Tracing.2.2.19302.1\lib\net45\Tracing.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
Expand Down
6 changes: 3 additions & 3 deletions Samples/WpfSample/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="2.0.2" targetFramework="net47" />
<package id="CommonServiceLocator" version="2.0.5" targetFramework="net47" />
<package id="MvvmLight" version="5.4.1.1" targetFramework="net47" />
<package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net47" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net47" />
<package id="Tracing" version="2.0.18322.5-pre" targetFramework="net47" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net47" />
<package id="Tracing" version="2.2.19302.1" targetFramework="net47" />
</packages>
11 changes: 7 additions & 4 deletions Tests/HttpClient.Caching.Tests/HttpClient.Caching.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net452</TargetFrameworks>
<AssemblyName>HttpClient.Caching.Tests</AssemblyName>
<PackageId>HttpClient.Caching.Tests</PackageId>
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
Expand All @@ -11,11 +11,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.4.1" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="Moq" Version="4.10.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
Expand Down
58 changes: 31 additions & 27 deletions build.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,55 @@
####################################################################
# VSTS Build Configuration, Version 1.1
#
# (c)2018 superdev GmbH
# VSTS Build Configuration, Version 1.3
#
# (c)2020 superdev GmbH
####################################################################

name: 1.0.$(date:yy)$(DayOfYear).$(rev:rr)

queue:
name: Hosted VS2017
demands:
- msbuild
- visualstudio
- vstest
name: 1.1.$(date:yy)$(DayOfYear).$(rev:rr)

pool:
vmImage: 'windows-2019'

trigger:
- master
- develop
- release/*
branches:
include:
- master
- develop
- release/*
- feature/*

paths:
exclude:
- README.md

variables:
solution: 'HttpClient.Caching.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
buildVersionPostfix: '-pre'

steps:
- task: bleddynrichards.Assembly-Info-Task.Assembly-Info-Task.Assembly-Info-Task@1
- task: bleddynrichards.Assembly-Info-Task.Assembly-Info-NetCore.Assembly-Info-NetCore@2
displayName: 'Set Assembly Manifest Data'
inputs:
FileNames: |
HttpClient.Caching.csproj
InsertAttributes: true
Title: 'HttpClient.Caching'
Product: 'HttpClient.Caching'
Description: ''
Company: 'superdev GmbH'
Copyright: '(c) $(date:yyyy) superdev GmbH'
Copyright: '(c) $(date:YYYY) superdev GmbH'
VersionNumber: '$(Build.BuildNumber)'
FileVersionNumber: '$(Build.BuildNumber)'


- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
displayName: 'Use NuGet 5.x'
inputs:
versionSpec: 4.4.1

versionSpec: 5.x

- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'

restoreSolution: '$(solution)'

- powershell: |
Write-Host "##vso[task.setvariable variable=PackageVersion]$(Build.BuildNumber)"
Expand All @@ -53,7 +59,7 @@ steps:
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '$(Parameters.solution)'
solution: '$(solution)'
msbuildArgs: ''
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
Expand All @@ -63,7 +69,7 @@ steps:
inputs:
command: test
projects: '**/*.Tests.csproj'
arguments: ''
arguments: '--framework netcoreapp3.1'

- task: DotNetCoreCLI@2
displayName: 'Pack NuGet PreRelease'
Expand Down Expand Up @@ -92,7 +98,5 @@ steps:

TargetFolder: '$(Build.ArtifactStagingDirectory)'


- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'