clj-commons / aleph

Asynchronous streaming communication for Clojure - web server, web client, and raw TCP/UDP
http://aleph.io
MIT License
2.54k stars 241 forks source link

:debug :save-request :debug-body? don't seem to produce the expected output #536

Closed alvatar closed 2 years ago

alvatar commented 4 years ago
(defn test [code]
  (try
    @(d/chain (http/post (str dropbox-url "oauth2/token")
                         {:throw-exceptions false
                          :debug true
                          :save-request? true
                          :debug-body? true
                          :body (json/generate-string
                                 {:code code
                                  :grant_type "authorization_code"})}))
    (catch Exception e
      (pprint e))))

Produces:

{:request-time 398,
 :aleph/keep-alive? true,
 :headers
 {"server" "nginx",
  "content-type" "application/json",
  "x-content-type-options" "nosniff",
  "x-frame-options" "DENY",
  "connection" "keep-alive",
  "transfer-encoding" "chunked",
  "x-dropbox-request-id" "a9239c1b2f1af7d382934d26a60f3289",
  "date" "Thu, 12 Mar 2020 09:55:58 GMT",
  "content-disposition" "attachment; filename='error'",
  "content-security-policy" "sandbox; frame-ancestors 'none'"},
 :status 400,
 :connection-time 70,
 :body
 #object[byte_streams.InputStream 0x2c3deb73 "byte_streams.InputStream@2c3deb73"]}

There is no :aleph/netty-request or :aleph/request-body

I saw in the tests the only GET is tested (while I actually believe GET is not supposed to have a body, or at least is not standard)

jaju commented 4 years ago

@alvatar - I do observe the :aleph/request and :aleph/netty-request entries in the returned map (on a different URL I tried, of course)

kachayev commented 4 years ago

@alvatar I cannot reproduce the issue on other URLs. Including all possible methods, no redirects vs. redirects, successful vs. non-successful response, and others. Including requests to "https://api.dropboxapi.com/oauth2/token" endpoint.

arnaudgeiser commented 2 years ago

As we weren't able to reproduce it and it has been 2 years ago, I will close the PR. Do not hesitate to open a new one whether you can give us more information.