(bind-func ghttp_copy_request_body_into_buffer
(lambda (request:ghttp_request* buf:i8* bufsize:i64)
(if (null? request)
(println "Error: request is null.")
(let ((bytes_read (convert (ghttp_get_body_len request) i64)))
;;(println "HTTP status:" (ghttp_status_code request))
(if (> bytes_read 0)
(if (<= bytes_read bufsize)
(begin (memcpy buf (ghttp_get_body request) bytes_read)
void)
(begin
(memcpy buf (ghttp_get_body request) bufsize)
(println "Warning: HTTP response body (" bytes_read " bytes) is too big for buffer (" bufsize " bytes). Dropping the rest of the body."))))))))