mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01: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:
parent
14a5dda24f
commit
6db1be738d
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user