Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
debug support
Browse files Browse the repository at this point in the history
  • Loading branch information
shamsimam committed Jun 16, 2020
1 parent 7c8d5c6 commit c1f5694
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/clj/qbits/jet/client/http.clj
Original file line number Diff line number Diff line change
Expand Up @@ -452,39 +452,41 @@
(.onResponseContentAsync request
(reify Response$AsyncContentListener
(onContent [_ _ byte-buffer callback]
(log-fn "received content" byte-buffer)
(log-fn "AsyncContentListener: received content" byte-buffer)
(if (protocols/closed? body-ch)
(let [ex (IOException. "Body channel closed unexpectedly")]
(log-fn "body channel closed unexpectedly")
(log-fn "AsyncContentListener: body channel closed unexpectedly" byte-buffer)
(report-error! ex)
(.failed callback ex)
(.abort request ex))
(async/put! body-ch (byte-buffer->bytes byte-buffer)
(fn [_] (.succeeded callback)))))))
(fn [_]
(log-fn "AsyncContentListener: invoking succeeded" byte-buffer)
(.succeeded callback)))))))

(.onResponseHeaders request
(reify Response$HeadersListener
(onHeaders [_ response]
(log-fn "received response headers")
(log-fn "HeadersListener: received response headers")
(async/put! ch (make-response request response abort-ch body-ch error-ch trailers-ch))
(when (util/http2-request? version)
(track-response-trailers trailers-ch body-ch content-provider-promise response)))))

(.onRequestFailure request
(reify Request$FailureListener
(onFailure [_ request throwable]
(log-fn "request failed" request throwable)
(log-fn "FailureListener: request failed" request throwable)
(report-error! throwable))))

(.onRequestSuccess request
(reify Request$SuccessListener
(onSuccess [_ request]
(log-fn "request succeeded" request))))
(log-fn "SuccessListener: request succeeded" request))))

(.send request
(reify Response$CompleteListener
(onComplete [_ result]
(log-fn "response complete" result)
(log-fn "CompleteListener: response complete" result)
(when (not (.isSucceeded result))
(report-error! (.getFailure result)))
(when-let [response (.getResponse result)]
Expand Down

0 comments on commit c1f5694

Please sign in to comment.