Skip to content

Commit

Permalink
Bump version to 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ed-ilyin committed Jul 6, 2017
1 parent 43b0aa4 commit 9d94ce7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 0.1.0 - Jule 6 2017
* moves to built-in Result

### 0.0.5 - June 29 2017
* adds delete method

Expand Down
4 changes: 2 additions & 2 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ NUGET
Chiron (6.2.1)
Aether (>= 8.0.2 < 9.0)
FParsec (>= 1.0 < 2.0)
EdIlyin.FSharp.Boxcar (0.0.5)
EdIlyin.FSharp.Boxcar (0.0.6)
EdIlyin.FSharp.Elm.Core
Hopac
EdIlyin.FSharp.Elm.Core (1.0.28)
EdIlyin.FSharp.Elm.Core (2.1)
Chiron
FSharp.Core
FParsec (1.0.2)
Expand Down
8 changes: 4 additions & 4 deletions src/EdIlyin.FSharp.Http/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("EdIlyin.FSharp.Http")>]
[<assembly: AssemblyProductAttribute("EdIlyin.FSharp.Http")>]
[<assembly: AssemblyDescriptionAttribute("HTTP decoders")>]
[<assembly: AssemblyVersionAttribute("0.0.5")>]
[<assembly: AssemblyFileVersionAttribute("0.0.5")>]
[<assembly: AssemblyVersionAttribute("0.1.0")>]
[<assembly: AssemblyFileVersionAttribute("0.1.0")>]
[<assembly: AssemblyConfigurationAttribute("Release")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "EdIlyin.FSharp.Http"
let [<Literal>] AssemblyProduct = "EdIlyin.FSharp.Http"
let [<Literal>] AssemblyDescription = "HTTP decoders"
let [<Literal>] AssemblyVersion = "0.0.5"
let [<Literal>] AssemblyFileVersion = "0.0.5"
let [<Literal>] AssemblyVersion = "0.1.0"
let [<Literal>] AssemblyFileVersion = "0.1.0"
let [<Literal>] AssemblyConfiguration = "Release"
33 changes: 20 additions & 13 deletions src/EdIlyin.FSharp.Http/Response.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,42 @@ open FSharp.Data

module Response =
let statusCode expecting =
Decode.satisfy
(fun (r:HttpResponse) -> r => Some r.StatusCode)
(fun sc -> if sc = expecting then Ok sc else Err sc)
(sprintf "status code %A" expecting)
let label = sprintf "a status code %A" expecting

Decode.primitive label
(fun (r:HttpResponse) ->
let sc = r.StatusCode
if sc = expecting then Decode.Decoded sc
else label => r |> Decode.ExpectingButGot
)


let bodyText =
Decode.satisfy (fun (r:HttpResponse) -> r, Some r.Body)
(fun body ->
match body with
| Binary _ -> Err "binary body"
| Text text -> Ok text
let label = "text body"

Decode.primitive label
(fun (r:HttpResponse) ->
match r.Body with
| Binary _ -> label => r |> Decode.ExpectingButGot
| Text text -> Decode.Decoded text
)
"text body"


let unpack parser async =
boxcar {
let! response = Job.fromAsync async |> Boxcar.catch

return!
let! result =
try
do printfn "Response %i from %s"
response.StatusCode
response.ResponseUrl

Decode.parseAny parser response
Decode.decode parser response

with | exn ->
sprintf "%s\n%A" exn.Message response |> Err
sprintf "%s\n%A" exn.Message response |> Error
|> Boxcar.fromResult

return result
}

0 comments on commit 9d94ce7

Please sign in to comment.