0

I am using poorly written SDK, that doesn't provide a method to work with received responses. The SDK is embedded script on my page.

In particular, using the SDK, when I do a post request to create a new user I can see userId in the response in my DevTool, but the SDK itself doesn't give me a way to fetch it in my code, so I can't store the user id in my db.

I figured if I can listen to responses that this SDK receives it will do the work for me.

So the question is it possible to listen all received responses on you page using native javascript?

Newbe
  • 1
  • 1
  • 1
    Can you just not use that SDK and do the request yourself? – Bergi Jul 02 '21 at 18:18
  • Depends on how the SDK is making the call, but in general yes you can intercept the response: https://stackoverflow.com/questions/45425169/intercept-fetch-api-requests-and-responses-in-javascript https://stackoverflow.com/questions/16959359/intercept-xmlhttprequest-and-modify-responsetext https://stackoverflow.com/questions/6884616/intercept-all-ajax-calls – Bergi Jul 02 '21 at 18:20
  • No, I have to use it. Technically the company provides `userId` via webhook, but it doesn't work for me anymore – Newbe Jul 02 '21 at 18:20

0 Answers0