Friday, 21 April 2017

Is there a way to make request/request-promise use XHR instead of Fetch for client requests?

So I noticed that recently, I can't see any of the JSON bodies of my POST requests in Chrome devTools. Turns out we're using request-promise, which uses request, which uses fetch for AJAX requests. On other sites, using just plain XHR POSTs, I can see the "Request Payload" section just fine. But when I try to introspect the requests for the app I'm working on, I see nothing there for POST requests.

Turns out, Chrome devtools has a history of having a hard time displaying the bodies of requests made using fetch and it looks like maybe the issue has regressed lately: https://bugs.chromium.org/p/chromium/issues/detail?id=457484#c48

So in the meantime, I'd like to just switch over to XHR instead of fetch. Does anyone know if the request library has a way to configure it to do that? I don't see anything in the docs, but maybe I'm missing something? https://github.com/request/request#requestoptions-callback



via RavenHursT

No comments:

Post a Comment