Skip to content

Instantly share code, notes, and snippets.

@mfp
Created January 25, 2009 18:49
Show Gist options
  • Save mfp/52494 to your computer and use it in GitHub Desktop.
Save mfp/52494 to your computer and use it in GitHub Desktop.
module ReloadPage_ = struct
open XHTML.M
open Xhtmltypes
open Ocsigen_http_frame
open Eliom_services
type page = exn list
type options = [ `HTTP11 | `OldCompat ]
let send ?(options = `HTTP11) ?(cookies=[]) ?charset ?code ~sp content =
match content with
_::_ -> Lwt.return (EliomExn (content, cookies))
| [] ->
let empty_result = Ocsigen_http_frame.empty_result () in
let code = match code with
| Some c -> c
| None -> match options with
`HTTP11 -> 303
| `OldCompat -> 302
in
Lwt.return
(EliomResult
{empty_result with
res_cookies= Eliom_services.cookie_table_of_eliom_cookies ~sp cookies;
res_code= code;
res_location = Some (Eliom_sessions.get_full_url sp);
})
end
module ReloadPage = Eliom_mkreg.MakeRegister(ReloadPage_)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment