diff options
| author | Adelyn Breedlove <[email protected]> | 2019-01-13 23:52:45 +0000 |
|---|---|---|
| committer | Adelyn Breedlove <[email protected]> | 2019-01-13 23:52:45 +0000 |
| commit | d95f0342f9cf2280b5d9794ab638c16a59c02a69 (patch) | |
| tree | 191164d198c07cf388d9aae8a54013e5613c272c /lib/http.ml | |
| parent | Merge branch 'dev' into 'master' (diff) | |
| parent | Add deriving sexp to models (diff) | |
| download | disml-d95f0342f9cf2280b5d9794ab638c16a59c02a69.tar.xz disml-d95f0342f9cf2280b5d9794ab638c16a59c02a69.zip | |
Merge branch 'switch-to-deriving_yojson' into 'master'
Switch to deriving yojson
See merge request Mishio595/disml!12
Diffstat (limited to 'lib/http.ml')
| -rw-r--r-- | lib/http.ml | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/http.ml b/lib/http.ml index f04a49f..9ef9334 100644 --- a/lib/http.ml +++ b/lib/http.ml @@ -2,7 +2,8 @@ module Make(T : S.Token) = struct open Core open Async open Cohttp - include T + + let token = T.token module Base = struct exception Invalid_Method @@ -35,12 +36,11 @@ module Make(T : S.Token) = struct | None -> raise Bad_response_headers) >>= fun () -> match resp |> Response.status |> Code.code_of_status with - | 200 -> body |> Cohttp_async.Body.to_string >>= Deferred.Or_error.return + | 200 -> body |> Cohttp_async.Body.to_string >>| Yojson.Safe.from_string >>= Deferred.Or_error.return | code -> body |> Cohttp_async.Body.to_string >>= fun body -> Deferred.Or_error.errorf "Unsuccessful response received: %d - %s" code body - let request ?(body=`Null) m path = rl := Rl.update ~f:(function | None -> |