extract method make-headers
This commit is contained in:
parent
ed53c967d7
commit
ad29d9e100
16
main.fnl
16
main.fnl
@ -46,14 +46,18 @@
|
|||||||
(: :sign ca-key))]
|
(: :sign ca-key))]
|
||||||
(crt:toPEM)))
|
(crt:toPEM)))
|
||||||
|
|
||||||
|
(fn make-headers [status attributes]
|
||||||
|
(let [h (headers.new)]
|
||||||
|
(h:append ":status" (tostring status))
|
||||||
|
(each [k v (pairs attributes)]
|
||||||
|
(h:append k v))
|
||||||
|
h))
|
||||||
|
|
||||||
(fn handle-sign-csr [out]
|
(fn handle-sign-csr [out]
|
||||||
(let [body (out:get_body_as_string)]
|
(let [body (out:get_body_as_string)
|
||||||
(doto (headers.new)
|
h (make-headers 200 { :content-type "text/plain" })]
|
||||||
(: :append ":status" :200)
|
(out:write_headers h false)
|
||||||
(: :append :content-type :text/plain)
|
|
||||||
(out:write_headers false))
|
|
||||||
(let [req (csr.new body)]
|
(let [req (csr.new body)]
|
||||||
(print :subject (req:getSubject))
|
|
||||||
(out:write_chunk (new-crt req) true))))
|
(out:write_chunk (new-crt req) true))))
|
||||||
|
|
||||||
(fn on-stream [sv out]
|
(fn on-stream [sv out]
|
||||||
|
Loading…
Reference in New Issue
Block a user