Skip to content

Commit

Permalink
Add Dream.set_status
Browse files Browse the repository at this point in the history
  • Loading branch information
aantron committed Feb 13, 2022
1 parent 55c4d0f commit 67e91f1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/dream.ml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ let json = Helpers.json
let redirect = Helpers.redirect
let empty = Helpers.empty
let status = Message.status
let set_status = Message.set_status



Expand Down
3 changes: 3 additions & 0 deletions src/dream.mli
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ val empty :
val status : response -> status
(** Response {!type-status}. For example, [`OK]. *)

val set_status : response -> status -> unit
(** Sets the response status. *)



(** {1 Headers} *)
Expand Down
5 changes: 4 additions & 1 deletion src/pure/message.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type client = {
some middleware to decide which headers to add. *)

type server = {
status : Status.status;
mutable status : Status.status;
mutable websocket : (Stream.stream * Stream.stream) option;
}

Expand Down Expand Up @@ -135,6 +135,9 @@ let response ?status ?code ?(headers = []) client_stream server_stream =
let status response =
response.specific.status

let set_status response status =
response.specific.status <- status



(* Headers *)
Expand Down
1 change: 1 addition & 0 deletions src/pure/message.mli
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ val response :
response

val status : response -> Status.status
val set_status : response -> Status.status -> unit



Expand Down

0 comments on commit 67e91f1

Please sign in to comment.