Skip to content

Commit

Permalink
Get rid of API to put stuff into service request context
Browse files Browse the repository at this point in the history
  • Loading branch information
joseferben committed Nov 12, 2020
1 parent 4a6da0d commit a7e288f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
3 changes: 0 additions & 3 deletions sihl/message/model.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ module Message = struct
let get_warning message = message.warning
let get_success message = message.success
let get_info message = message.info
let ctx_key : t Core.Ctx.key = Core.Ctx.create_key ()
let ctx_add message ctx = Core.Ctx.add ctx_key message ctx
let get ctx = Core.Ctx.find ctx_key ctx
end

module Entry = struct
Expand Down
2 changes: 0 additions & 2 deletions sihl/message/sihl_message.mli
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ val get_error : t -> string list
val get_warning : t -> string list
val get_success : t -> string list
val get_info : t -> string list
val get : Core.Ctx.t -> t option
val ctx_add : t -> Core.Ctx.t -> Core.Ctx.t
3 changes: 2 additions & 1 deletion sihl/middleware/middleware_message.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ module Http = Sihl_http
module Message = Sihl_message
open Lwt.Syntax

let log_src = Logs.Src.create ~doc:"Message Middleware" "sihl.middleware.message"
let log_src = Logs.Src.create "sihl.middleware.message"

module Logs = (val Logs.src_log log_src : Logs.LOG)

let key : Message.t Opium_kernel.Hmap.key =
Opium_kernel.Hmap.Key.create ("message", Message.sexp_of_t)
;;

let find req = Opium_kernel.Hmap.find_exn key (Opium_kernel.Request.env req)
let find_opt req = Opium_kernel.Hmap.find key (Opium_kernel.Request.env req)

let set message req =
Expand Down

0 comments on commit a7e288f

Please sign in to comment.