HTTP for Carp, expressed as a parser and a data structure.
(load "[email protected]:carpentry-org/[email protected]")
Currently, all you can do is parse and build HTTP requests and responses, by
using Request.parse
and Response.parse
.
Hopefully you’ll soon be able to do more than that!
(load "[email protected]:carpentry-org/[email protected]")
(def txt "POST / HTTP/1.1\r
Host: https://veitheller.de\r
User-Agent: curl/7.54.0\r
Accept: */*\r
\r
hi!")
(defn main []
(let [x (Request.parse txt)]
(match x
(Result.Success r) (println* &r)
(Result.Error e) (println* &e))))
Have fun!