Dream OCaml
Dream के लिए OCaml स्निपेट, जो /pixel.gif पर आने वाली रिक्वेस्ट का जवाब empty GIF से देता है। GIF स्टार्टअप पर एक ही बार डिकोड होता है।
Dream OCaml
(* dune: (executable (name pixel) (libraries dream base64)) *)
let gif = Base64.decode_exn "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
let () =
Dream.run ~interface:"0.0.0.0" ~port:8080
@@ Dream.logger
@@ Dream.router
[
Dream.get "/pixel.gif" (fun _ ->
Dream.respond
~headers:[ ("Content-Type", "image/gif"); ("Cache-Control", "no-store") ]
gif);
]
फ़्रेमवर्क के मौजूदा डॉक्यूमेंटेशन से मिलाकर जाँचा गया।
जाँचें
curl -sI http://localhost:8080/pixel.gif