I am trying to write a server with Woo. I need to handle HTTP body sent by:POST method. However, I don't know how to read the body.
In env, there are :RAW-BODY and :CLACK.IO look like somewhere to read body from. But I have no clue how to read it. No documents in repo and I searched on google and looks like everyone just gives examples of giving a response to client rather than read HTTP body.
Can anyone help me?
I check FLEXI-STREAMS package and figure out VECTOR-INPUT-STREAM (the type of :raw-body) can read by read-byte, and read-sequence.
So the solution is sort of:
(let ((a (make-array 11 :element-type '(unsigned-byte 8))))
(read-sequence a (getf env :raw-body))
(format t "~a" a))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With