Skip to content
Open
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
21 changes: 0 additions & 21 deletions .github/workflows/NET472.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/NET60.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/dotnet.yml

This file was deleted.

25 changes: 15 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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

47 changes: 47 additions & 0 deletions .github/workflows/version-sweeper.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,34 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Http" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" />
<PackageReference Include="OpenTelemetry" />
<PackageReference Include="OpenTelemetry.Exporter.Console" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
<PackageReference Include="Polly" />
<PackageReference Include="Polly.Extensions.Http" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" />
<PackageReference Include="System.ComponentModel.Annotations" />

<PackageReference Include="FluTe" Version="0.5.0.1" />


<PackageReference Include="OpenTelemetry" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc2" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc2" />
<PackageReference Include="Polly" Version="7.*" />
<PackageReference Include="Polly.Extensions.Http" Version="3.*" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="3.*" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.*" />


<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="WireMock.Net" Version="1.3.6" />
<PackageReference Include="System.Reactive.Linq" Version="5.0.0" />
<PackageReference Include="WireMock.Net" Version="1.5.18" />


<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="5.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Http.Client.Options.WireServer\Http.Client.Options.WireServer.csproj" />
<ProjectReference Include="..\..\Http.Client.Options\Http.Client.Options.csproj" />

</ItemGroup>
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
3 changes: 2 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
<!-- <PackageReference Update="@(PackageReference)" PrivateAssets="All"/> -->
<!-- </ItemGroup>-->
<PropertyGroup>
<Version>7.3.0-beta.1</Version>
<Version>8.0.0-beta.1</Version>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<IncludeSymbols>true</IncludeSymbols>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<SkipValidatePackageReferences>true</SkipValidatePackageReferences>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>

</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

<!-- <Target Name="net6" Condition="$(Framework) == 'net'"-->
<ItemGroup>
<PackageReference Include="WireMock.Net" Version="1.3.6" />
</ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions Http.Client.Options/Http.Client.Options.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

<PropertyGroup>
<RootNamespace>Http.Options</RootNamespace>
<LangVersion>8</LangVersion>
<LangVersion>11</LangVersion>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<Version>$(Version)</Version>
<TargetFramework>net6.0</TargetFramework>

</PropertyGroup>
<PropertyGroup Label="Package Properties">
Expand Down
57 changes: 57 additions & 0 deletions Http.Client.Options/Options/HttpClientCompressionOptions.cs
Original file line number Diff line number Diff line change
@@ -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<StringWithQualityHeaderValue> EncodingHeaders = new List<StringWithQualityHeaderValue>
{
new StringWithQualityHeaderValue("gzip"),
new StringWithQualityHeaderValue("deflate"),
};

public HttpClientCompressionOptions()
{
AutomaticDecompression = true;
Encoding = new Dictionary<string, bool>
{
["gzip"] = true,
["deflate"] = true,
};
}

public bool AutomaticDecompression { get; set; }
public Dictionary<string, bool> 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);
}
}
}
}
Loading