Skip to content

Commit fc0eb63

Browse files
authored
Merge pull request #108 from hannesm/dispatch.0.5.0
adapt to dispatch 0.5.0 API changes
2 parents 9ef128f + f951901 commit fc0eb63

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lib/webmachine.ml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -917,17 +917,18 @@ module Make(IO:IO)(Clock:CLOCK) = struct
917917

918918
let dispatch table =
919919
let table =
920-
List.map (fun (p, t, mk_resource) ->
921-
(p, t, fun path_info dispatch_path ~body ~request ->
922-
let resource = mk_resource () in
923-
to_handler ?dispatch_path ~path_info ~resource ~body ~request ()))
924-
table
920+
Dispatch.create
921+
(List.map (fun (p, t, mk_resource) ->
922+
(p, t, fun path_info dispatch_path ~body ~request ->
923+
let resource = mk_resource () in
924+
to_handler ?dispatch_path ~path_info ~resource ~body ~request ()))
925+
table)
925926
in
926927
fun ~body ~request ->
927928
let path = Uri.path (Cohttp.Request.uri request) in
928929
match Dispatch.dispatch table path with
929-
| Result.Error _ -> return None
930-
| Result.Ok handler -> handler ~body ~request >>= fun x -> return (Some x)
930+
| None -> return None
931+
| Some handler -> handler ~body ~request >>= fun x -> return (Some x)
931932

932933
let dispatch' table =
933934
dispatch (List.map (fun (m, r) ->

webmachine.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ depends: [
1414
"ocaml" {>= "4.03.0"}
1515
"ptime" {>= "0.8.0"}
1616
"cohttp" {>= "1.0.0"}
17-
"dispatch" {>= "0.3.0" & < "0.5.0"}
17+
"dispatch" {>= "0.5.0"}
1818
"dune" {>= "1.0"}
1919
"ounit" {with-test & >= "1.0.2"}
2020
"re" {>= "1.7.2"}

0 commit comments

Comments
 (0)