package sihl
The modular functional web framework
Install
Dune Dependency
Authors
Maintainers
Sources
sihl-queue-0.1.5.tbz
sha256=bfa7bde9af02bb83d5ca39d54797b05b43317f033d93d24ca86ca42ff8ef83a1
sha512=6bb8727f65116e8042aa1fb77b3c14851ce5238f7b412adadf0f8e5b52d5310e8f06056c96bf76a82ffd7096753f49b2b0482f41e18ee1ca94310b874fe81bf9
doc/src/sihl.http/res.ml.html
Source file res.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
open Http_core (* TODO [jerben] remove all opium references *) module OpiumResponse = struct (* We want to be able to derive show and eq from our own response type t *) type t = Opium_kernel.Response.t let equal _ _ = false let pp _ _ = () end type body = | String of string | File_path of string [@@deriving show, eq] type t = { content_type : content_type ; redirect : string option ; body : body option ; headers : headers ; (* TODO [jerben] Remove all Opium references *) opium_res : OpiumResponse.t option ; cookies : (string * string) list ; status : int } [@@deriving show, eq] let file path content_type = { content_type ; redirect = None ; body = Some (File_path path) ; headers = [] ; opium_res = None ; cookies = [] ; status = 200 } ;; let html = { content_type = Html ; redirect = None ; body = None ; headers = [] ; opium_res = None ; cookies = [] ; status = 200 } ;; let json = { content_type = Json ; redirect = None ; body = None ; headers = [] ; opium_res = None ; cookies = [] ; status = 200 } ;; let redirect path = { content_type = Html ; redirect = Some path ; body = None ; headers = [] ; opium_res = None ; cookies = [] ; status = 302 } ;; let redirect_path res = res.redirect let body res = res.body let set_body str res = { res with body = Some (String str) } let headers res = res.headers let set_headers headers res = { res with headers } let content_type res = res.content_type let set_content_type content_type res = { res with content_type } (* TODO [jerben] this is a hack and has to be removed *) let opium_res res = res.opium_res (* TODO [jerben] this is a hack and has to be removed *) let set_opium_res opium_res res = { res with opium_res = Some opium_res } let res = res.cookies (* TODO [jerben] Rename to add_cookie *) let ~key ~data res = { res with cookies = List.cons (key, data) res.cookies } let status res = res.status let set_status status res = { res with status }
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>