• (headers-seq http-agnt)
Returns the HTTP response headers in order as a sequence of
[String,String] pairs. The first 'header' name may be null for the
HTTP status line.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/http/agent.clj:341 top

(defn headers-seq
  "Returns the HTTP response headers in order as a sequence of
  [String,String] pairs.  The first 'header' name may be null for the
  HTTP status line."
  [http-agnt]
  (let [^HttpURLConnection conn (::connection @http-agnt)
        f (fn thisfn [^Integer i]
            ;; Get value first because first key may be nil.
            (when-let [value (.getHeaderField conn i)]
              (cons [(.getHeaderFieldKey conn i) value]
                    (thisfn (inc i)))))]
    (lazy-seq (f 0))))
Vars in clojure.contrib.http.agent/headers-seq: defn lazy-seq let
Used in 0 other vars

Comments top

No comments for headers-seq. Log in to add a comment.