mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Move to node fetch API for web requests instead of XHR (#1552)
* Use node-fetch instead of xhr * Remove XMLHttpRequest.js // FREEBIE * Avoid calling json() on non json responses Previously we would catch and swallow JSON parsing errors resulting from an empty response, though empty responses are normal from a few endpoints, like requesting sms or voice registration codes. Since the JSON parsing call is now handled internally by node-fetch, we have to keep closer track of our expected response type to avoid throwing an exception. // FREEBIE
This commit is contained in:
@@ -42,7 +42,6 @@
|
||||
require('./js/backup');
|
||||
|
||||
window.nodeSetImmediate = setImmediate;
|
||||
window.nodeXMLHttpRequest = require("./js/XMLHttpRequest").XMLHttpRequest;
|
||||
window.nodeWebSocket = require("websocket").w3cwebsocket;
|
||||
|
||||
// Linux seems to periodically let the event loop stop, so this is a global workaround
|
||||
@@ -51,4 +50,7 @@
|
||||
}, 1000);
|
||||
|
||||
window.EmojiConvertor = require('emoji-js');
|
||||
window.nodeFetch = require('node-fetch');
|
||||
window.httpsAgent = require('https').Agent;
|
||||
window.nodeBuffer = Buffer;
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user