 ;; define constants for all of the HTTP status codes defined in the
 ;; java class
 (doseq [name http-constants]
-  (let [key (http-constant->kw name)
+  (let [key (http-constant->sym name)
         val (-> (.getField java.net.HttpURLConnection name)
       (.get nil))]
     (intern *ns* key val)))
 
 
+;; ## HTTP/Ring utility functions
 
 (defn acceptable-content-type
   "Returns a boolean indicating whether the `candidate` mime type

;; ## Utility functions related to HTTP

(ns com.puppetlabs.http
  (:require [ring.util.response :as rr]
            [cheshire.core :as json]
            [clojure.reflect :as r]
            [clojure.string :as s]))

(def http-constants
  (->> java.net.HttpURLConnection

    (map str)
    (filter #(.startsWith % "HTTP_"))))

(defn http-constant->sym
  "Convert the name a constant from the java.net.HttpURLConnection class into a
  symbol that we will use to define a Clojure constant."
  [name]
  (-> name
    (s/split #"HTTP_")
