clj-http-lite icon indicating copy to clipboard operation
clj-http-lite copied to clipboard

401 does not shoot a slingshot; raises an Exception

Open timothypratley opened this issue 13 years ago • 4 comments

=> (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.

timothypratley avatar Sep 09 '12 21:09 timothypratley

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 avatar Sep 16 '12 22:09 dakrone

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 avatar Sep 16 '12 22:09 dakrone

@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)

dakrone avatar Sep 16 '12 22:09 dakrone

@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.

timothypratley avatar Sep 26 '12 03:09 timothypratley