0

I'm trying to get an OAuth application up, but I fail because the API servers won't talk to me. Unfortunatly the used clj-apache-http won't tell me what was the problem, I only get this warning:

WARNUNG: Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth realm="http%3A%2F%2FSERVERNAME"}
Exception in thread "Thread-1" java.lang.RuntimeException: java.lang.Exception: JSON error (unexpected character): I (example.clj:1)
        at clojure.lang.AFn.run(AFn.java:28)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Exception: JSON error (unexpected character): I (example.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:5440)
        at clojure.lang.Compiler.load(Compiler.java:5857)
        at clojure.lang.RT.loadResourceScript(RT.java:340)
        at clojure.lang.RT.loadResourceScript(RT.java:331)
        at clojure.lang.RT.load(RT.java:409)
        at clojure.lang.RT.load(RT.java:381)
        at clojure.core$load$fn__4511.invoke(core.clj:4905)
        at clojure.core$load.doInvoke(core.clj:4904)
        at clojure.lang.RestFn.invoke(RestFn.java:409)
        at clojure.core$load_one.invoke(core.clj:4729)

Ok, now that isn't helping me. There is a strange character I as the first one in the response - that's clearly no JSON.

I want to get the log level of apaches HTTPClient up to DEBUG now, but I don't know how to set system properties via leiningen. Any tips?

2 Answers 2

1

This is a way to get all requests by clj-apache-http through a local debugging proxy:

(require ['com.twinql.clojure.http :as 'http])

(:content 
  (http/get (java.net.URI. "http://yourhost.com")
    :parameters (http/map->params {
      :default-proxy (http/http-host
        :host "127.0.0.1" 
        :port 8765)}) :as :string))
Sign up to request clarification or add additional context in comments.

Comments

0

Alternatively, you could add this to your log4j.properties:

log4j.logger.httpclient.wire.header=DEBUG
log4j.logger.httpclient.wire.content=DEBUG
log4j.logger.org.apache.commons.httpclient=DEBUG
log4j.logger.org.apache.http=DEBUG
log4j.logger.org.apache.http.wire=DEBUG

Which will dump all communication to your log file. This is useful don't want to change the code that makes the request.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.