hiredman / clj-http-lite

A lite version of clj-http that uses the jre's HttpURLConnection
http://clojars.org/clj-http-lite
42 stars 12 forks source link

401 does not shoot a slingshot; raises an Exception #1

Open timothypratley opened 12 years ago

timothypratley commented 12 years ago

=> (use 'clj-http.client) => (get "http://www3.v1host.com/Tideworks/VersionOne/rest-1.v1/Data/Team") IOException Authentication failure sun.net.www.protocol.http.HttpURLConnection. getInputStream (HttpURLConnection.java:1470)

clj-http doesn't have this issue, seems to be specific to lite

I'm currently doing a text compare with the message to detect it.

dakrone commented 12 years ago

I think since clj-http-lite is supposed to be the lightest thing that is still usable, having to include slingshot goes against that goal.

I'll update the readme to point out the difference.

dakrone commented 12 years ago

Actually, it looks like slingshot is actually used for clj-http-lite, I'll look into why it's not being caught and rethrown as a Stone.

dakrone commented 12 years ago

@timothypratley do you have more details about the code you're using? I get a Slingshot exception for 401 responses when I use the lite client:

user=> (use 'clj-http.lite.client)
nil
user=> (get "http://www3.v1host.com/Tideworks/VersionOne/rest-1.v1/Data/Team")
ExceptionInfo clj-http: status 401  clj-http.lite.client/wrap-exceptions/fn--1132 (client.clj:35)
timothypratley commented 12 years ago

@dakrone On computerA with a fresh project.clj I add [clj-http-lite "0.1.0"] as a dependency, lein deps, lein repl and I get IOException Authentication failure sun.net.www.protocol.http.HttpURLConnection However on computerB I get ExceptionInfo clj-http: status 401 clj-http.lite.client/wrap-exceptions/fn--1132 (client.clj:35) Both are Win7 64bit, A is java 1.7.0_01-b08, B is java 1.6.0_27-b07 I'd happily provide more information or diagnosis there is anything I should check... Just to be clear I'm not sure if this is a bug with clj-http-lite or not and I have a work around.