Implement basic HTTP status checking in fetch method.

This commit is contained in:
Dimitri Fontaine 2015-04-17 21:37:21 +02:00
parent cb94993064
commit 2a6ad888d0

View File

@ -29,8 +29,12 @@
should-close
status)
(drakma:http-request url :force-binary t :want-stream t)
;; TODO: check the status-code
(declare (ignore status-code uri stream status))
(declare (ignore uri stream))
(when (not (= 200 status-code))
(log-message :fatal "HTTP Error ~a: ~a" status-code status)
(error status))
(let* ((source-stream (flexi-streams:flexi-stream-stream http-stream))
(content-length
(parse-integer (cdr (assoc :content-length headers)))))