Skip to content

Commit

Permalink
Complete the transformation to a middleware (#77)
Browse files Browse the repository at this point in the history
Finish transformation to  more generic middleware.
  • Loading branch information
dbrattli authored Mar 4, 2021
1 parent 795811c commit 53e8b62
Show file tree
Hide file tree
Showing 31 changed files with 1,860 additions and 1,090 deletions.
245 changes: 129 additions & 116 deletions README.md

Large diffs are not rendered by default.

23 changes: 9 additions & 14 deletions examples/github/GitHub.fsproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Oryx" Version="3.0.0-beta-001" />
<PackageReference Include="Oryx.ThothJsonNet" Version="3.0.0-beta-001" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Ply" Version="0.3.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
</Project>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
2 changes: 1 addition & 1 deletion examples/github/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ open Oryx
open System.Net.Http
open Oryx.ThothJsonNet.ResponseReader
open Thoth.Json.Net
open FSharp.Control.Tasks.ContextInsensitive
open FSharp.Control.Tasks

[<EntryPoint>]
let main argv =
Expand Down
6 changes: 6 additions & 0 deletions examples/github/paket.references
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
group Examples

Thoth.Json.Net
Oryx
Oryx.ThothJsonNet
Newtonsoft.Json
4 changes: 2 additions & 2 deletions examples/wikisearch/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ let asyncMain argv =
use client = new HttpClient()

let ctx =
Context.defaultContext
|> Context.withHttpClient client
HttpContext.defaultContext
|> HttpContext.withHttpClient client

let! result = request "F#" |> runAsync ctx
printfn "Result: %A" result
Expand Down
2 changes: 1 addition & 1 deletion extensions/Oryx.NewtonsoftJson/ResponseReader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module ResponseReader =
/// </summary>
/// <param name="decoder">Decoder to use. </param>
/// <returns>Decoded context.</returns>
let json<'TResult> : HttpHandler<HttpContent, 'TResult> =
let json<'TResult> : IHttpHandler<HttpContent, 'TResult> =

let parser (stream: Stream) =
use sr = new StreamReader(stream)
Expand Down
2 changes: 1 addition & 1 deletion extensions/Oryx.SystemTextJson/ResponseReader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module ResponseReader =
/// </summary>
/// <param name="options">JSON serializer options to use. </param>
/// <returns>Decoded context.</returns>
let json<'TResult> (options: JsonSerializerOptions) : HttpHandler<HttpContent, 'TResult> =
let json<'TResult> (options: JsonSerializerOptions) : IHttpHandler<HttpContent, 'TResult> =
let parser stream =
(JsonSerializer.DeserializeAsync<'TResult>(stream, options))
.AsTask()
Expand Down
2 changes: 1 addition & 1 deletion extensions/Oryx.ThothJsonNet/ResponseReader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module ResponseReader =
/// </summary>
/// <param name="decoder">Decoder to use. </param>
/// <returns>Decoded context.</returns>
let json<'TResult> (decoder: Decoder<'TResult>) : HttpHandler<HttpContent, 'TResult> =
let json<'TResult> (decoder: Decoder<'TResult>) : IHttpHandler<HttpContent, 'TResult> =
let parser (stream: Stream) : Task<'TResult> =
task {
let! ret = decodeStreamAsync decoder stream
Expand Down
5 changes: 4 additions & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,7 @@ group Examples
storage: none

nuget Ply
nuget Thoth.Json.Net
nuget Thoth.Json.Net
nuget Oryx prerelease
nuget Oryx.ThothJsonNet prerelease
nuget Newtonsoft.Json
646 changes: 634 additions & 12 deletions paket.lock

Large diffs are not rendered by default.

58 changes: 0 additions & 58 deletions src/Builder.fs

This file was deleted.

20 changes: 0 additions & 20 deletions src/Chunk.fs

This file was deleted.

54 changes: 0 additions & 54 deletions src/Error.fs

This file was deleted.

119 changes: 0 additions & 119 deletions src/Fetch.fs

This file was deleted.

Loading

0 comments on commit 53e8b62

Please sign in to comment.