package sihl
The modular functional web framework
Install
Dune Dependency
Authors
Maintainers
Sources
sihl-0.1.2.tbz
sha256=69705a3a35f204acfdda62f61056e3f0ec3ef5bcd1df1508be65b066a0b1df9c
sha512=1987d211f56d0261eefbae978065a4e6781d60ad94b08597875307e5cf6e5a1b79787d9c79f784f5a9f77c35203cfd0b488841a07adfd87b0710d6fd65422b94
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
open Base open Http_core (* TODO 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; 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 this is a hack and has to be removed *) let opium_res res = res.opium_res (* TODO 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 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)"
>