From ea5202a7965ebb0188675fb3e43cd5953d09bd98 Mon Sep 17 00:00:00 2001 From: Maxime Mangel Date: Mon, 6 May 2019 10:12:32 +0200 Subject: [PATCH] Release version 2.1.0 --- CHANGELOG.md | 6 ++++++ src/Thoth.Json.Giraffe.fsproj | 2 +- src/ThothSerializer.fs | 6 ++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 137fb17..e484176 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +## 2.1.0 + +### Fixed + +* Fix encoding when passing `None` + ## 2.0.0 ### Changed diff --git a/src/Thoth.Json.Giraffe.fsproj b/src/Thoth.Json.Giraffe.fsproj index 17ed9c2..8b1965f 100644 --- a/src/Thoth.Json.Giraffe.fsproj +++ b/src/Thoth.Json.Giraffe.fsproj @@ -7,7 +7,7 @@ https://github.com/MangelMaxime/Thoth fsharp;json;Giraffe;ASP.NET;Core Maxime Mangel - 2.0.0 + 2.1.0 netstandard2.0 diff --git a/src/ThothSerializer.fs b/src/ThothSerializer.fs index c199fc8..8077059 100644 --- a/src/ThothSerializer.fs +++ b/src/ThothSerializer.fs @@ -76,8 +76,7 @@ type ThothSerializer (?isCamelCase : bool, ?extra: ExtraCoders) = interface IJsonSerializer with member __.SerializeToString (o : 'T) = - let t = o.GetType() - let encoder = Encode.Auto.generateEncoderCached(t, ?isCamelCase=isCamelCase, ?extra=extra) + let encoder = Encode.Auto.generateEncoderCached<'T>(?isCamelCase=isCamelCase, ?extra=extra) encoder o |> Encode.toString 0 member __.Deserialize<'T> (json : string) = @@ -108,8 +107,7 @@ type ThothSerializer (?isCamelCase : bool, ?extra: ExtraCoders) = } member __.SerializeToBytes<'T>(o : 'T) : byte array = - let t = o.GetType() - let encoder = Encode.Auto.generateEncoderCached(t, ?isCamelCase=isCamelCase, ?extra=extra) + let encoder = Encode.Auto.generateEncoderCached<'T>(?isCamelCase=isCamelCase, ?extra=extra) // TODO: Would it help to create a pool of buffers for the memory stream? use stream = new MemoryStream() use writer = new StreamWriter(stream, Utf8EncodingWithoutBom, DefaultBufferSize)