package sihl
The modular functional web framework
Install
Dune Dependency
Authors
Maintainers
Sources
sihl-0.1.4.tbz
sha256=49fe887d05083b37523cd6e7ca35239822c561fe7109dd383c30aeb4259a7b98
sha512=4135ad42a75fb9adc3e853a466b696d9ee6d7a9d8acf0cee9fd5f5485679a517f524ce704e2d153df4a7c4f1d14df9f94ab2a8fbe5b36e744b505daab1d40f3d
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 92 93 94 95 96 97 98 99 100
open Base 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)"
>