1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

E2e infura requests (#14394)

* Redirect infura requests to localhost while e2e

* Change requests from Infura to localhost (ganache)

* Included blacklisted hosts

* Fix behaviour for all urls

* Added a couple of explorers and reorg

* Remove repeated line

* Lint fix

* Removed other services aside from infura

* Includes changed for 'ends with'

* Fix security handling of host by including listed of arrays
This commit is contained in:
seaona 2022-04-08 16:54:43 +02:00 committed by GitHub
parent 14a5dda24f
commit 6db1be738d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,23 @@
const blacklistedHosts = [
'goerli.infura.io',
'kovan.infura.io',
'mainnet.infura.io',
'rinkeby.infura.io',
'ropsten.infura.io',
];
async function setupMocking(server, testSpecificMock) {
await server.forAnyRequest().thenPassThrough();
await server.forAnyRequest().thenPassThrough({
beforeRequest: (req) => {
const { host } = req.headers;
if (blacklistedHosts.includes(host)) {
return {
url: 'http://localhost:8545',
};
}
return {};
},
});
await server.forPost('https://api.segment.io/v1/batch').thenCallback(() => {
return {