Skip to content

Commit

Permalink
Added a new overload to And method to allow easier chaining and tra…
Browse files Browse the repository at this point in the history
…nsformations
  • Loading branch information
oskardudycz committed Jun 30, 2022
1 parent c7f1011 commit 1e35f80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Ogooreck/API/ApiSpecification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ public static Func<HttpRequestMessage, HttpRequestMessage> HEADERS(params Action
public static Action<HttpRequestHeaders> IF_MATCH(string ifMatch, bool isWeak = true) =>
headers => headers.IfMatch.Add(new EntityTagHeaderValue($"\"{ifMatch}\"", isWeak));


public static Action<HttpRequestHeaders> IF_MATCH(object ifMatch, bool isWeak = true) =>
IF_MATCH(ifMatch.ToString()!, isWeak);


public static Task<HttpResponseMessage> And(this Task<HttpResponseMessage> response,
Func<HttpResponseMessage, HttpResponseMessage> and) =>
response.ContinueWith(t => and(t.Result));


public static Task And(this Task<HttpResponseMessage> response, Func<HttpResponseMessage, Task> and) =>
response.ContinueWith(t => and(t.Result));

public static Task And<TResult>(this Task<HttpResponseMessage> response, Func<HttpResponseMessage, Task<TResult>> and) =>
response.ContinueWith(t => and(t.Result));

public static Task And(this Task<HttpResponseMessage> response, Func<Task> and) =>
response.ContinueWith(_ => and());

Expand Down
2 changes: 1 addition & 1 deletion src/Ogooreck/Ogooreck.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionPrefix>0.2.1</VersionPrefix>
<VersionPrefix>0.3.0</VersionPrefix>
<TargetFramework>net6.0</TargetFramework>
<GenerateAssemblyTitleAttribute>true</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>true</GenerateAssemblyDescriptionAttribute>
Expand Down

0 comments on commit 1e35f80

Please sign in to comment.