package sihl
The modular functional web framework
Install
Dune Dependency
Authors
Maintainers
Sources
sihl-0.1.3.tbz
sha256=3d1acdd1eae24a7131033656f90b5d20c1621e6ef92957edf88a09b8b5f2d9e9
sha512=d224f54e20a9465c7a03d534dadcb2b9a181ae87c13731840db945aab37534f6f3982c5cb25a197e90c17d8772da062b19fa92bb93ed53a8b736c3776a7776db
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)"
>