diff --git a/.github/workflows/NET472.yml b/.github/workflows/NET472.yml
deleted file mode 100644
index 9269f36..0000000
--- a/.github/workflows/NET472.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-name: .NET472
-
-on: [push, pull_request]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- - name: Setup .NET
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: net472
- - name: Restore dependencies
- run: dotnet restore
- - name: Build
- run: dotnet build --no-restore
- - name: Test
- run: dotnet test --no-build --verbosity normal
diff --git a/.github/workflows/NET60.yml b/.github/workflows/NET60.yml
deleted file mode 100644
index c8c52f4..0000000
--- a/.github/workflows/NET60.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: .NET60
-
-on:
- push:
- branches: [ master ]
- pull_request:
- branches: [ master ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
- - name: Setup .NET
- uses: actions/setup-dotnet@v2
- with:
- dotnet-version: 6.0.x
- - name: Restore dependencies
- run: dotnet restore
- - name: Build
- run: dotnet build --no-restore --framework net6.0
- - name: Test
- run: dotnet test --no-build --verbosity normal --framework net6.0
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
deleted file mode 100644
index 59d6e7f..0000000
--- a/.github/workflows/dotnet.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: .NET50
-
-on:
- push:
- branches: [ master ]
- pull_request:
- branches: [ master ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- - name: Setup .NET
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 5.0.x
- - name: Restore dependencies
- run: dotnet restore
- - name: Build
- run: dotnet build --no-restore
- - name: Test
- run: dotnet test --no-build --verbosity normal
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f1262c4..e641899 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,37 +1,42 @@
-name: Release
+name: release
on:
workflow_dispatch:
push:
branches:
- "beta"
- "prerelease"
+ - "master"
+
+
env:
PROJECT_PATH: 'Http.Client.Options/Http.Client.Options.csproj'
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}/output
NUGET_PUSH_URL: ${{ secrets.NUGET_PUSH_URL }}
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
- DOTNET_VERSION: '6.0.x'
- TARGET_FRAMEWORKS: 'net6.0'
jobs:
-
+ test:
+ uses: ./test.yml@beta
+
release:
+ needs: test
name: Release
- runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
+ runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
+
- name: Setup .NET
- uses: actions/setup-dotnet@v2
- with:
- dotnet-version: ${{ env.DOTNET_VERSION }}
-
+ uses: actions/setup-dotnet@v3
+
+ - run: echo '${{ steps.stepid.outputs.dotnet-version }}'
+
- name: Install dependencies
run: dotnet restore
-
+
- name: Semantic Release
id: release
uses: cycjimmy/semantic-release-action@v3
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..8c47230
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,50 @@
+name: dotnet test
+
+on:
+ workflow_dispatch:
+ push:
+ branches: [ main, master, beta, release, prerelease]
+ pull_request:
+ branches: [ main, master, beta, release, prerelease ]
+
+jobs:
+ build:
+
+
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ dotnet: [ '6.*', '7.*']
+ name: Test w/t ${{ matrix.dotnet }}
+ steps:
+ - uses: actions/checkout@v3
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: ${{ matrix.dotnet }}
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build
+ run: dotnet build --no-restore
+
+ - name: Test
+ run: dotnet test --no-build --logger trx --results-directory "reports/${{ matrix.dotnet }}/tests"
+
+ - name: Upload dotnet test results
+ uses: actions/upload-artifact@v3
+ with:
+ name: test-results-${{ matrix.dotnet }}
+ path: reports/${{ matrix.dotnet }}/tests
+ if: ${{ always() }}
+ - uses: dorny/test-reporter@v1
+ with:
+ path: reports/${{ matrix.dotnet }}/tests
+ name: Test report ${{ matrix.dotnet }}
+ reporter: dotnet-trx
+ fail-on-error: 'true'
+ if: ${{ always() }}
+# - name: Summery Report
+# run: |
+# echo "- Test w/t ${{ matrix.dotnet }} done" >> $GITHUB_STEP_SUMMARY
+
diff --git a/.github/workflows/version-sweeper.yml b/.github/workflows/version-sweeper.yml
new file mode 100644
index 0000000..cf06e35
--- /dev/null
+++ b/.github/workflows/version-sweeper.yml
@@ -0,0 +1,47 @@
+# The name used in the GitHub UI for the workflow
+name: '.net version sweeper'
+
+# When to run this action:
+# - Scheduled on the first of every month
+# - Manually runable from the GitHub UI with a reason
+on:
+ schedule:
+ - cron: '0 0 1 * *'
+ workflow_dispatch:
+ inputs:
+ reason:
+ description: 'The reason for running the workflow'
+ required: true
+ default: 'Manual run'
+
+# Run on the latest version of Ubuntu
+jobs:
+ version-sweep:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ issues: write
+ statuses: write
+
+ # Checkout the repo into the workspace within the VM
+ steps:
+ - uses: actions/checkout@v2
+
+ # If triggered manually, print the reason why
+ - name: 'Print manual run reason'
+ if: ${{ github.event_name == 'workflow_dispatch' }}
+ run: |
+ echo "Reason: ${{ github.event.inputs.reason }}"
+
+ # Run the .NET version sweeper
+ # Issues will be automatically created for any non-ignored projects that are targeting non-LTS versions
+ - name: .NET version sweeper
+ id: dotnet-version-sweeper
+ uses: dotnet/versionsweeper@v1.2
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ owner: ${{ github.repository_owner }}
+ name: ${{ github.repository }}
+ branch: ${{ github.ref }}
+ sdkCompliance: true
diff --git a/.playground/Http.Options.PlaygroundCore/Http.Options.PlaygroundCore.csproj b/.playground/Http.Options.PlaygroundCore/Http.Options.PlaygroundCore.csproj
index 726214e..c66fadd 100644
--- a/.playground/Http.Options.PlaygroundCore/Http.Options.PlaygroundCore.csproj
+++ b/.playground/Http.Options.PlaygroundCore/Http.Options.PlaygroundCore.csproj
@@ -3,24 +3,34 @@
Exe
net6.0
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
-
+
+
+
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0664b1..71ba941 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,28 @@
# Semantic Versioning Changelog
+# [8.0.0-beta.1](https://github.com/dinavinter/Http.Options/compare/v7.2.0...v8.0.0-beta.1) (2023-03-13)
+
+
+### Bug Fixes
+
+* release ([b034c67](https://github.com/dinavinter/Http.Options/commit/b034c67e478ee0a18fc77ff35c120daf3a120f8d))
+
+
+### chore
+
+* drop support for net5.0 ([88c7f40](https://github.com/dinavinter/Http.Options/commit/88c7f409a75c4669c9cb252ab6a91bceb40b590b))
+
+
+### Features
+
+* **core:** change fields to auto properties to allow serialization - this required for using microsoft.extensions.options from a config file. ([5900fca](https://github.com/dinavinter/Http.Options/commit/5900fca0678b3dea3b16ee98f9fa6f2cda9a9df5))
+* **core:** support compression ([b09e868](https://github.com/dinavinter/Http.Options/commit/b09e868782a60159e41d7dffd54685e8c86e8a4c))
+
+
+### BREAKING CHANGES
+
+* Drop support for net5.0 or lower net versions.
+
# [7.3.0-prerelease.1](https://github.com/dinavinter/Http.Options/compare/v7.2.0...v7.3.0-prerelease.1) (2023-02-10)
diff --git a/Directory.Build.props b/Directory.Build.props
index 214dd2c..86874bc 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -4,11 +4,12 @@
- 7.3.0-beta.1
+ 8.0.0-beta.1
false
true
true
true
+ net6.0;net7.0
diff --git a/Http.Client.Options.WireServer/Http.Client.Options.WireServer.csproj b/Http.Client.Options.WireServer/Http.Client.Options.WireServer.csproj
index eda162b..39c76b3 100644
--- a/Http.Client.Options.WireServer/Http.Client.Options.WireServer.csproj
+++ b/Http.Client.Options.WireServer/Http.Client.Options.WireServer.csproj
@@ -2,9 +2,10 @@
true
- net6.0
+ $(TargetFrameworks)
+
diff --git a/Http.Client.Options/Http.Client.Options.csproj b/Http.Client.Options/Http.Client.Options.csproj
index 307767c..b764095 100644
--- a/Http.Client.Options/Http.Client.Options.csproj
+++ b/Http.Client.Options/Http.Client.Options.csproj
@@ -2,11 +2,10 @@
Http.Options
- 8
+ 11
$(Version)
$(Version)
$(Version)
- net6.0
diff --git a/Http.Client.Options/Options/HttpClientCompressionOptions.cs b/Http.Client.Options/Options/HttpClientCompressionOptions.cs
new file mode 100644
index 0000000..4111a97
--- /dev/null
+++ b/Http.Client.Options/Options/HttpClientCompressionOptions.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Http;
+
+namespace Http.Options
+{
+ public class HttpClientCompressionOptions
+ {
+ private static List EncodingHeaders = new List
+ {
+ new StringWithQualityHeaderValue("gzip"),
+ new StringWithQualityHeaderValue("deflate"),
+ };
+
+ public HttpClientCompressionOptions()
+ {
+ AutomaticDecompression = true;
+ Encoding = new Dictionary
+ {
+ ["gzip"] = true,
+ ["deflate"] = true,
+ };
+ }
+
+ public bool AutomaticDecompression { get; set; }
+ public Dictionary Encoding { get; set; }
+
+ public void ConfigureHttpClientBuilder(HttpMessageHandlerBuilder httpClientBuilder)
+ {
+ // var handler= new HttpClientHandler()
+
+ if (httpClientBuilder.PrimaryHandler is HttpClientHandler httpClientHandler)
+ {
+ if (AutomaticDecompression && httpClientHandler.SupportsAutomaticDecompression)
+ {
+ httpClientHandler.AutomaticDecompression = DecompressionMethods.Brotli |
+ DecompressionMethods.Deflate |
+ DecompressionMethods.GZip;
+ }
+ }
+ }
+
+ public void ConfigureHttpClient(HttpClient httpClient)
+ {
+ foreach (var headerValue in EncodingHeaders.Where(x =>
+ Encoding.TryGetValue(x.Value, out var enabled) && enabled))
+ {
+ httpClient.DefaultRequestHeaders.AcceptEncoding.Add(headerValue);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Http.Client.Options/Options/HttpClientOptions.cs b/Http.Client.Options/Options/HttpClientOptions.cs
index a18048c..8c67ee9 100644
--- a/Http.Client.Options/Options/HttpClientOptions.cs
+++ b/Http.Client.Options/Options/HttpClientOptions.cs
@@ -15,6 +15,7 @@ public class HttpClientOptions
public HttpClientHandlerOptions Handler { get; set; }= new HttpClientHandlerOptions();
public HttpConnectionOptions Connection { get; set; }= new HttpConnectionOptions();
public HttpTelemetryOptions Telemetry { get; set; }= new HttpTelemetryOptions();
+ public HttpClientCompressionOptions Compression { get; set; }= new HttpClientCompressionOptions();
public HttpClientOptions()
{
@@ -48,6 +49,7 @@ protected virtual void ConfigureHttpMessageHandlerBuilder(HttpMessageHandlerBuil
Timeout?.ConfigureHttpClientBuilder(builder);
Telemetry?.ConfigureHttpClientBuilder(builder, services);
Polly?.ConfigureHttpClientBuilder(builder, services);
+ Compression?.ConfigureHttpClientBuilder(builder);
// builder.AdditionalHandlers.Insert(0, new HttpClientScopeHandler(builder, this));
}
@@ -57,6 +59,7 @@ protected virtual void ConfigureHttpMessageHandlerBuilder(HttpMessageHandlerBuil
protected virtual void ConfigureHttpClient(HttpClient httpClient)
{
Connection?.ConfigureHttpClient(httpClient);
+ Compression?.ConfigureHttpClient(httpClient);
}
@@ -92,6 +95,7 @@ public void Configure(string name, HttpClientOptions options)
options.Handler = Handler ?? options.Handler;
options.Polly = Polly ?? options.Polly;
options.Telemetry = Telemetry ?? options.Telemetry;
+ options.Compression = Compression ?? options.Compression;
}
public void Configure(HttpClientOptions options)
diff --git a/Http.Options.Benchmarks/Http.Options.Benchmarks.csproj b/Http.Options.Benchmarks/Http.Options.Benchmarks.csproj
index 97ace56..f9c9595 100644
--- a/Http.Options.Benchmarks/Http.Options.Benchmarks.csproj
+++ b/Http.Options.Benchmarks/Http.Options.Benchmarks.csproj
@@ -7,7 +7,8 @@
preview
Exe
Http.Options.Benchmarks
- net6.0
+ net6.0
+
diff --git a/Http.Options.UnitTests/Http.Options.UnitTests.csproj b/Http.Options.UnitTests/Http.Options.UnitTests.csproj
index 9c3b88a..c7a8f7d 100644
--- a/Http.Options.UnitTests/Http.Options.UnitTests.csproj
+++ b/Http.Options.UnitTests/Http.Options.UnitTests.csproj
@@ -6,21 +6,20 @@
latest
- net6.0;
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -29,7 +28,7 @@
-
+
diff --git a/Http.Options.UnitTests/HttpClientThroghtputTests.cs b/Http.Options.UnitTests/HttpClientThroghtputTests.cs
index 639c5e7..5d3e325 100644
--- a/Http.Options.UnitTests/HttpClientThroghtputTests.cs
+++ b/Http.Options.UnitTests/HttpClientThroghtputTests.cs
@@ -13,7 +13,6 @@
using Http.Client.Options.Tracing;
using Http.Options.Tracing.OpenTelemetry;
using Http.Options.Tracing.Processors;
-using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.EventSource;
using Newtonsoft.Json;
diff --git a/Http.Options.sln b/Http.Options.sln
index fecd583..c8cc60e 100644
--- a/Http.Options.sln
+++ b/Http.Options.sln
@@ -53,6 +53,7 @@ Global
{11FF6998-A3EF-46CE-85FB-64624DEB49A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{11FF6998-A3EF-46CE-85FB-64624DEB49A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{11FF6998-A3EF-46CE-85FB-64624DEB49A4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {11FF6998-A3EF-46CE-85FB-64624DEB49A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5177538B-BD6E-49A0-B4BA-7D3BACADDAE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5177538B-BD6E-49A0-B4BA-7D3BACADDAE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5177538B-BD6E-49A0-B4BA-7D3BACADDAE4}.Release|Any CPU.ActiveCfg = Release|Any CPU