Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

All entity-as methods must now accept three arguments.

This avoids some odd order-of-execution bug in recent Clojure 1.2
builds, at the cost of backwards compatibility. Sorry.
  • Loading branch information...
commit 85ce13fe913ae2f3cfc4231b835aed1303806b7e 1 parent 6a3500a
@rnewman authored
Showing with 8 additions and 15 deletions.
  1. +1 −1  project.clj
  2. +7 −14 src/com/twinql/clojure/http.clj
View
2  project.clj
@@ -1,4 +1,4 @@
-(defproject com.twinql.clojure/clj-apache-http "1.2.1"
+(defproject com.twinql.clojure/clj-apache-http "2.0.0"
:description "Clojure HTTP library using the Apache HttpClient."
:dependencies [[org.clojure/clojure "1.2.0-master-SNAPSHOT"]
[org.clojure/clojure-contrib "1.2.0-master-SNAPSHOT"]
View
21 src/com/twinql/clojure/http.clj
@@ -164,21 +164,21 @@
;;; Entity processors.
;;; None of these care about the third argument, which is the status
;;; code.
-(defmulti entity-as (fn [entity as & args] as))
+(defmulti entity-as (fn [entity as status] as))
(defmethod entity-as :identity
- [entity as & args] entity)
+ [entity as status] entity)
(defmethod entity-as nil
- [entity as & args] entity)
+ [entity as status] entity)
-(defmethod entity-as :stream [#^HttpEntity entity as & args]
+(defmethod entity-as :stream [#^HttpEntity entity as status]
(.getContent entity))
-(defmethod entity-as :reader [#^HttpEntity entity as & args]
+(defmethod entity-as :reader [#^HttpEntity entity as status]
(duck/reader (.getContent entity)))
-(defmethod entity-as :string [#^HttpEntity entity as & args]
+(defmethod entity-as :string [#^HttpEntity entity as status]
(duck/slurp* (.getContent entity)))
(defn preemptive-basic-auth-filter
@@ -285,14 +285,7 @@
response {:code (.getStatusCode status-line)
:reason (.getReasonPhrase status-line)
:content
-
- ;; Just while we go through the transition
- ;; period from 2-arg to 3-arg..
- (try
- (entity-as entity as (.getStatusCode status-line))
- (catch java.lang.IllegalArgumentException e
- ;; Wrong number of args.
- (entity-as entity as)))
+ (entity-as entity as (.getStatusCode status-line))
:entity entity
:client http-client
Please sign in to comment.
Something went wrong with that request. Please try again.