EventListener can't access wire-level request in case of failure
See original GitHub issueI’m trying to log the URI of failed requests using an EventListener
. The URI may be rewritten by Interceptors and I’m interested in the URI of the wire-level request.
In case of a successful request, the URI of the wire-level request can be obtained by by calling Response.request()
. But if the request fails and there is no Response
object, there seems to be no way to get this information; Only the original is accessible through Call.request()
.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
eventlistener can't access variable outside function
but I can't access the read element when trying to attach it to another event listener outside the function. Any idea how to...
Read more >EventTarget.addEventListener() - Web APIs | MDN
An object that specifies characteristics about the event listener. ... called when the browser // attempts to access the passive property.
Read more >Using a Request Object Event Listener - AWS Documentation
After the send method on the AWS.Request object is called, the event handler executes when the service object receives an AWS.Response object. For...
Read more >Uncaught TypeError cannot read property 'addeventlistener' of ...
In JavaScript, a very common error is the Uncaught TypeError Cannot read property 'addeventlistener' of null. This error occurs when JavaScript is not...
Read more >JavaScript HTML DOM EventListener - W3Schools
Add an event listener that fires when a user clicks a button: ... The addEventListener() method makes it easier to control how the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you need a quick & dirty fix you can use Call tags and interceptors to hack around this. Here’s a sketch:
Just hit this but without the ability to control the creation of the request. Just realised I’m saved by the Call.Factory which I can trivially decorate to set the tag I need.
Same solution just using Call.Factory wrapper instead of an interceptor.
We might want to make Call.Factory usage best practices for clients? Coil, Media3, Retrofit all use it, so it’s standard anyway.