Open ghost opened 1 year ago
@dbrattli could you please help with understanding next things:?
// json handler w/ FSharp.Json library
let json<'TResult> (options: JsonConfig) (source: HttpHandler<HttpContent>): HttpHandler<'TResult> =
let parser (stream: Stream) =
use sr = new StreamReader(stream)
// `ReadToEnd` can throw OOM exception. What is the best way to handle it in Oryx?
let textJson = sr.ReadToEnd()
Json.deserializeEx<'TResult> options textJson
parse parser source
What is the best way to handle OOM exception for StreamReader.ReadToEnd()
? I have only seen one for Thoth, but I don't know if it will be an OK to return Result wrapped model
match ret with
| Ok result -> return result
| Error error -> return raise (JsonDecodeException)
What is the purpose of JsonPushStreamContent
and do I need to implement that as well?
It would be nice to have support for F#
FSharp.Json
library to the already existing Thoth, Newtonsoft and SystemTextJson.Will try implementing that for my local project for now, if it works -> will create a PR in this repo.
Any suggestions on impoving the code will be highly appreciated. 🙂