Skip to content

Commit

Permalink
Make all optional dependencies opt-in instead of opt-out
Browse files Browse the repository at this point in the history
  • Loading branch information
dakrone committed May 24, 2015
1 parent 41ef6b8 commit a5813fd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
22 changes: 13 additions & 9 deletions README.org
Expand Up @@ -383,13 +383,14 @@ using:
#+END_SRC

Note that this feature is currently beta and uses [[https://github.com/weavejester/crouton][Crouton]] to parse the body of
the request. If you do not want to use this feature, you can exclude Crouton
from clj-http's dependencies without causing any problems like so:
the request. If you do not want to use this feature, you can include Crouton in
addition to clj-http as a dependency like so:

#+BEGIN_SRC clojure
(defproject foo "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.3.0"]
[clj-http "0.6.0" :exclusions [crouton]]])
[clj-http "0.6.0"]
[crouton "1.0.0"]])
#+END_SRC

Note also that HEAD requests will not return a body, in which case this setting will have no effect.
Expand Down Expand Up @@ -720,15 +721,18 @@ function.
* Optional dependenciess

clj-http currently has four optional dependencies, =cheshire=, =crouton=,
=tools.reader= and =ring/ring-codec=. Any number of them may be removed by
excluding them from the clj-http dependency in your project.clj:
=tools.reader= and =ring/ring-codec=. Any number of them may be included by
adding them with the clj-http dependency in your project.clj:

#+BEGIN_SRC clojure
(defproject foo "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.5.1"]
[clj-http "0.3.4" :exclusions [cheshire crouton
org.clojure/tools.reader
ring/ring-codec]]])
:dependencies [[org.clojure/clojure "1.6.0"]
[clj-http "1.1.2"]
;; optional dependencies
[cheshire "5.4.0"] ;; for :as :json
[crouton "0.1.2"] ;; for :decode-body-headers
[org.clojure/tools.reader] ;; for :as :clojure
[ring/ring-codec]]]]) ;; for :as :x-www-form-urlencoded
#+END_SRC

* Known issues / Issues you may run into
Expand Down
1 change: 1 addition & 0 deletions changelog.org
Expand Up @@ -103,6 +103,7 @@ List of user-visible changes that have gone into each release
** 2015-05-23
- merged https://github.com/dakrone/clj-http/pull/264 to add support for
coercion of urlencoded data
- make ALL optional dependencies opt-in, rather than opt-out
** Released 1.1.2
** 2015-05-06
- bumped dependencies for transit-clj and tools.reader
Expand Down
16 changes: 9 additions & 7 deletions project.clj
@@ -1,4 +1,4 @@
(defproject clj-http "1.1.3-SNAPSHOT"
(defproject clj-http "2.0.0-SNAPSHOT"
:description "A Clojure HTTP library wrapping the Apache HttpComponents client."
:url "https://github.com/dakrone/clj-http/"
:license {:name "The MIT License"
Expand All @@ -14,12 +14,14 @@
[commons-io "2.4"]
[com.cognitect/transit-clj "0.8.271"]
[slingshot "0.12.2"]
[cheshire "5.4.0"]
[crouton "0.1.2"]
[org.clojure/tools.reader "0.9.2"]
[potemkin "0.3.13"]
[ring/ring-codec "1.0.0"]]
:profiles {:dev {:dependencies [[org.clojure/clojure "1.6.0"]
[potemkin "0.3.13"]]
:profiles {:dev {:dependencies [;; optional deps
[cheshire "5.4.0"]
[crouton "0.1.2"]
[org.clojure/tools.reader "0.9.2"]
[ring/ring-codec "1.0.0"]
;; other (testing) deps
[org.clojure/clojure "1.6.0"]
[org.clojure/tools.logging "0.3.1"]
[log4j "1.2.17"]
[ring/ring-jetty-adapter "1.3.2"]
Expand Down

0 comments on commit a5813fd

Please sign in to comment.