I have a case where I'm trying to do some HTTP request using js/fetch and then coerce the body. js/fetch returns a Promise fulfilled with a Response type, which you then call .json / .text / etc. These methods return a new promise that must be awaited.
I understand my mistake: :leave should operate on the :response key in the ctx, not the :request key. This was not obvious to me even though the examples are written that way. 😵
I've only tested this in CLJS with native promises. Currently, an async value returned by the
:leave
function on an interceptor is not awaited.Example:
Result: Prints
42
Expected result: Prints
43
; 40 + 1 (for enter) + 1 (for leave) + 1 (for handler)I have a case where I'm trying to do some HTTP request using
js/fetch
and then coerce the body.js/fetch
returns a Promise fulfilled with aResponse
type, which you then call.json
/.text
/ etc. These methods return a new promise that must be awaited.Please advise! Is this expected behavior?